From 79d28db3f916d53a6c22509ecef77588b1930be6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 30 Mar 2018 17:47:21 +0200 Subject: [PATCH] Fix migration 200 --- .../migrations/0200-video-published-at.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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: { { const data = { type: Sequelize.DATE, - allowNull: false, + allowNull: true, defaultValue: Sequelize.NOW } await utils.queryInterface.addColumn('video', 'publishedAt', data) @@ -20,6 +20,16 @@ async function up (utils: { await utils.sequelize.query(query) } + // Sequelize does not alter the column with NOW as default value + { + const data = { + type: Sequelize.DATE, + allowNull: false, + defaultValue: Sequelize.NOW + } + await utils.queryInterface.changeColumn('video', 'publishedAt', data) + } + } function down (options) { -- 2.25.1