aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/initializers/constants.ts2
-rw-r--r--server/initializers/migrations/0630-banner.ts50
2 files changed, 51 insertions, 1 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 1e74f3eab..1deabec87 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -24,7 +24,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
24 24
25// --------------------------------------------------------------------------- 25// ---------------------------------------------------------------------------
26 26
27const LAST_MIGRATION_VERSION = 625 27const LAST_MIGRATION_VERSION = 630
28 28
29// --------------------------------------------------------------------------- 29// ---------------------------------------------------------------------------
30 30
diff --git a/server/initializers/migrations/0630-banner.ts b/server/initializers/migrations/0630-banner.ts
new file mode 100644
index 000000000..5766bb171
--- /dev/null
+++ b/server/initializers/migrations/0630-banner.ts
@@ -0,0 +1,50 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7 db: any
8}): Promise<void> {
9
10 {
11 await utils.sequelize.query(`ALTER TABLE "avatar" RENAME to "actorImage"`)
12 }
13
14 {
15 const data = {
16 type: Sequelize.INTEGER,
17 defaultValue: null,
18 allowNull: true
19 }
20 await utils.queryInterface.addColumn('actorImage', 'type', data)
21 }
22
23 {
24 await utils.sequelize.query(`UPDATE "actorImage" SET "type" = 1`)
25 }
26
27 {
28 const data = {
29 type: Sequelize.INTEGER,
30 defaultValue: null,
31 allowNull: false
32 }
33 await utils.queryInterface.changeColumn('actorImage', 'type', data)
34 }
35
36 {
37 await utils.sequelize.query(
38 `ALTER TABLE "actor" ADD COLUMN "bannerId" INTEGER REFERENCES "actorImage" ("id") ON DELETE SET NULL ON UPDATE CASCADE`
39 )
40 }
41}
42
43function down (options) {
44 throw new Error('Not implemented.')
45}
46
47export {
48 up,
49 down
50}