From f35ea4355a1d689950235fa51a08aee1b9f9532f Mon Sep 17 00:00:00 2001 From: andsandv Date: Fri, 6 Feb 2015 15:18:54 +0100 Subject: [PATCH 1/4] #80 Rename event ypes --- lib/eventType.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/eventType.js b/lib/eventType.js index 60d06788f4..bda72298fe 100644 --- a/lib/eventType.js +++ b/lib/eventType.js @@ -1,8 +1,8 @@ module.exports = { featureCreated : 'feature-created', featureUpdated : 'feature-updated', - featureArchive : 'feature-archive', - featureRevive : 'feature-revive', + featureArchive : 'feature-archived', + featureRevive : 'feature-revived', strategyCreated: 'strategy-created', strategyDeleted: 'strategy-deleted' }; \ No newline at end of file From 0ad2bde14ab948640353458378d8319e1c8a3884 Mon Sep 17 00:00:00 2001 From: andsandv Date: Mon, 9 Feb 2015 18:28:51 +0100 Subject: [PATCH 2/4] #80 More renaming --- lib/eventDiffer.js | 4 ++-- lib/eventType.js | 4 ++-- lib/featureApi.js | 2 +- lib/featureArchiveApi.js | 2 +- lib/featureDb.js | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/eventDiffer.js b/lib/eventDiffer.js index 6b14292c49..eb2662cb6d 100644 --- a/lib/eventDiffer.js +++ b/lib/eventDiffer.js @@ -9,8 +9,8 @@ var strategyTypes = [ var featureTypes = [ eventType.featureCreated, eventType.featureUpdated, - eventType.featureArchive, - eventType.featureRevive + eventType.featureArchived, + eventType.featureRevived ]; function baseTypeFor(event) { diff --git a/lib/eventType.js b/lib/eventType.js index bda72298fe..dce3b67bbf 100644 --- a/lib/eventType.js +++ b/lib/eventType.js @@ -1,8 +1,8 @@ module.exports = { featureCreated : 'feature-created', featureUpdated : 'feature-updated', - featureArchive : 'feature-archived', - featureRevive : 'feature-revived', + featureArchived : 'feature-archived', + featureRevived : 'feature-revived', strategyCreated: 'strategy-created', strategyDeleted: 'strategy-deleted' }; \ No newline at end of file diff --git a/lib/featureApi.js b/lib/featureApi.js index 1593817699..1be1f84116 100644 --- a/lib/featureApi.js +++ b/lib/featureApi.js @@ -89,7 +89,7 @@ module.exports = function (app) { featureDb.getFeature(featureName) .then(function () { return eventStore.create({ - type: eventType.featureArchive, + type: eventType.featureArchived, createdBy: userName, data: { name: featureName diff --git a/lib/featureArchiveApi.js b/lib/featureArchiveApi.js index 19c12bd09d..a4b8752c41 100644 --- a/lib/featureArchiveApi.js +++ b/lib/featureArchiveApi.js @@ -19,7 +19,7 @@ module.exports = function (app) { validateRequest(req) .then(function() { return eventStore.create({ - type: eventType.featureRevive, + type: eventType.featureRevived, createdBy: req.connection.remoteAddress, data: req.body }); diff --git a/lib/featureDb.js b/lib/featureDb.js index 9baf329c86..c64ae80c1a 100644 --- a/lib/featureDb.js +++ b/lib/featureDb.js @@ -13,11 +13,11 @@ eventStore.on(eventType.featureUpdated, function (event) { return updateFeature(event.data); }); -eventStore.on(eventType.featureArchive, function (event) { +eventStore.on(eventType.featureArchived, function (event) { return archiveFeature(event.data); }); -eventStore.on(eventType.featureRevive, function (event) { +eventStore.on(eventType.featureRevived, function (event) { return reviveFeature(event.data); }); From 53c92db954d68b84c8ac129f38f64b5054f51811 Mon Sep 17 00:00:00 2001 From: andsandv Date: Tue, 10 Feb 2015 16:27:59 +0100 Subject: [PATCH 3/4] #80 Add schema change --- migrations/20150210152531-006-rename-eventtype.js | 1 + migrations/sql/006-rename-eventtype.down.sql | 2 ++ migrations/sql/006-rename-eventtype.up.sql | 2 ++ 3 files changed, 5 insertions(+) create mode 100644 migrations/20150210152531-006-rename-eventtype.js create mode 100644 migrations/sql/006-rename-eventtype.down.sql create mode 100644 migrations/sql/006-rename-eventtype.up.sql diff --git a/migrations/20150210152531-006-rename-eventtype.js b/migrations/20150210152531-006-rename-eventtype.js new file mode 100644 index 0000000000..cdd0b89518 --- /dev/null +++ b/migrations/20150210152531-006-rename-eventtype.js @@ -0,0 +1 @@ +module.exports = require('../lib/migrationRunner').create('006-rename-eventtype'); \ No newline at end of file diff --git a/migrations/sql/006-rename-eventtype.down.sql b/migrations/sql/006-rename-eventtype.down.sql new file mode 100644 index 0000000000..70354d0d53 --- /dev/null +++ b/migrations/sql/006-rename-eventtype.down.sql @@ -0,0 +1,2 @@ +UPDATE events SET type=feature-revive WHERE type=feature-revived; +UPDATE events SET type=feature-archive WHERE type=feature-archived; \ No newline at end of file diff --git a/migrations/sql/006-rename-eventtype.up.sql b/migrations/sql/006-rename-eventtype.up.sql new file mode 100644 index 0000000000..eb5bed1693 --- /dev/null +++ b/migrations/sql/006-rename-eventtype.up.sql @@ -0,0 +1,2 @@ +UPDATE events SET type=feature-revived WHERE type=feature-revive; +UPDATE events SET type=feature-archived WHERE type=feature-archive; \ No newline at end of file From 5a5bac2d6c0e5bb9c6389e6fa973771b63c3db8c Mon Sep 17 00:00:00 2001 From: andsandv Date: Tue, 10 Feb 2015 16:56:06 +0100 Subject: [PATCH 4/4] #80 Add quotes to sql from feedback --- migrations/sql/006-rename-eventtype.down.sql | 4 ++-- migrations/sql/006-rename-eventtype.up.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/migrations/sql/006-rename-eventtype.down.sql b/migrations/sql/006-rename-eventtype.down.sql index 70354d0d53..787edface4 100644 --- a/migrations/sql/006-rename-eventtype.down.sql +++ b/migrations/sql/006-rename-eventtype.down.sql @@ -1,2 +1,2 @@ -UPDATE events SET type=feature-revive WHERE type=feature-revived; -UPDATE events SET type=feature-archive WHERE type=feature-archived; \ No newline at end of file +UPDATE events SET type='feature-revive' WHERE type='feature-revived'; +UPDATE events SET type='feature-archive' WHERE type='feature-archived'; \ No newline at end of file diff --git a/migrations/sql/006-rename-eventtype.up.sql b/migrations/sql/006-rename-eventtype.up.sql index eb5bed1693..cfb23b849d 100644 --- a/migrations/sql/006-rename-eventtype.up.sql +++ b/migrations/sql/006-rename-eventtype.up.sql @@ -1,2 +1,2 @@ -UPDATE events SET type=feature-revived WHERE type=feature-revive; -UPDATE events SET type=feature-archived WHERE type=feature-archive; \ No newline at end of file +UPDATE events SET type='feature-revived' WHERE type='feature-revive'; +UPDATE events SET type='feature-archived' WHERE type='feature-archive'; \ No newline at end of file