]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/initializers/migrations/0200-video-published-at.ts
Merge branch 'release/1.4.0' into develop
[github/Chocobozzz/PeerTube.git] / server / initializers / migrations / 0200-video-published-at.ts
index edaf4a145c0f37d6c9a61ac8bca9c7d6c9e1efc5..1701ea07a669152f62c2dd57d7bd71715b9da7d6 100644 (file)
@@ -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) {