aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0800-video-replace-file.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/migrations/0800-video-replace-file.ts')
-rw-r--r--server/initializers/migrations/0800-video-replace-file.ts38
1 files changed, 38 insertions, 0 deletions
diff --git a/server/initializers/migrations/0800-video-replace-file.ts b/server/initializers/migrations/0800-video-replace-file.ts
new file mode 100644
index 000000000..f924a4d92
--- /dev/null
+++ b/server/initializers/migrations/0800-video-replace-file.ts
@@ -0,0 +1,38 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7}): Promise<void> {
8 const { transaction } = utils
9
10 {
11 const query = 'DELETE FROM "videoSource" WHERE "videoId" IS NULL'
12 await utils.sequelize.query(query, { transaction })
13 }
14
15 {
16 const query = 'ALTER TABLE "videoSource" ALTER COLUMN "videoId" SET NOT NULL'
17 await utils.sequelize.query(query, { transaction })
18 }
19
20 {
21 const data = {
22 type: Sequelize.DATE,
23 allowNull: true,
24 defaultValue: null
25 }
26
27 await utils.queryInterface.addColumn('video', 'inputFileUpdatedAt', data, { transaction })
28 }
29}
30
31function down (options) {
32 throw new Error('Not implemented.')
33}
34
35export {
36 up,
37 down
38}