summaryrefslogtreecommitdiff
path: root/lib/migrations
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-06-17 16:09:33 +0800
committerCheng-Han, Wu2016-06-17 16:09:33 +0800
commitdbc126b156f301c18d3963cd269dcd1eac040873 (patch)
tree0032b539ed308d3972e209fd3752011e0ac673ef /lib/migrations
parent56b4739e6d2f455f7b9a40f8c54b3f543bef1790 (diff)
Add support of saving note revision and improve app start and stop procedure to ensure data integrity
Diffstat (limited to 'lib/migrations')
-rw-r--r--lib/migrations/20160607060246-support-revision.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/migrations/20160607060246-support-revision.js b/lib/migrations/20160607060246-support-revision.js
new file mode 100644
index 00000000..9721d7fc
--- /dev/null
+++ b/lib/migrations/20160607060246-support-revision.js
@@ -0,0 +1,24 @@
+'use strict';
+
+module.exports = {
+ up: function (queryInterface, Sequelize) {
+ queryInterface.addColumn('Notes', 'savedAt', Sequelize.DATE);
+ queryInterface.createTable('Revisions', {
+ id: Sequelize.UUID,
+ noteId: Sequelize.UUID,
+ patch: Sequelize.TEXT,
+ lastContent: Sequelize.TEXT,
+ content: Sequelize.TEXT,
+ length: Sequelize.INTEGER,
+ createdAt: Sequelize.DATE,
+ updatedAt: Sequelize.DATE
+ });
+ return;
+ },
+
+ down: function (queryInterface, Sequelize) {
+ queryInterface.dropTable('Revisions');
+ queryInterface.removeColumn('Notes', 'savedAt');
+ return;
+ }
+};