aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r--server/initializers/migrations/0200-video-published-at.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/server/initializers/migrations/0200-video-published-at.ts b/server/initializers/migrations/0200-video-published-at.ts
index edaf4a145..1701ea07a 100644
--- a/server/initializers/migrations/0200-video-published-at.ts
+++ b/server/initializers/migrations/0200-video-published-at.ts
@@ -9,7 +9,7 @@ async function up (utils: {
9 { 9 {
10 const data = { 10 const data = {
11 type: Sequelize.DATE, 11 type: Sequelize.DATE,
12 allowNull: false, 12 allowNull: true,
13 defaultValue: Sequelize.NOW 13 defaultValue: Sequelize.NOW
14 } 14 }
15 await utils.queryInterface.addColumn('video', 'publishedAt', data) 15 await utils.queryInterface.addColumn('video', 'publishedAt', data)
@@ -20,6 +20,16 @@ async function up (utils: {
20 await utils.sequelize.query(query) 20 await utils.sequelize.query(query)
21 } 21 }
22 22
23 // Sequelize does not alter the column with NOW as default value
24 {
25 const data = {
26 type: Sequelize.DATE,
27 allowNull: false,
28 defaultValue: Sequelize.NOW
29 }
30 await utils.queryInterface.changeColumn('video', 'publishedAt', data)
31 }
32
23} 33}
24 34
25function down (options) { 35function down (options) {