aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0150-avatar-cascade.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-29 19:10:13 +0100
committerChocobozzz <me@florianbigard.com>2017-12-29 19:10:13 +0100
commitc5911fd347c76e8bdc05ea9f3ee9efed4a58c236 (patch)
treeb8d287daca6c45305090cbec9da97d1155f275bd /server/initializers/migrations/0150-avatar-cascade.ts
parent8b0d42ee372de6589796be26b83e5bffb1b69cdf (diff)
downloadPeerTube-c5911fd347c76e8bdc05ea9f3ee9efed4a58c236.tar.gz
PeerTube-c5911fd347c76e8bdc05ea9f3ee9efed4a58c236.tar.zst
PeerTube-c5911fd347c76e8bdc05ea9f3ee9efed4a58c236.zip
Begin to add avatar to actors
Diffstat (limited to 'server/initializers/migrations/0150-avatar-cascade.ts')
-rw-r--r--server/initializers/migrations/0150-avatar-cascade.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/server/initializers/migrations/0150-avatar-cascade.ts b/server/initializers/migrations/0150-avatar-cascade.ts
new file mode 100644
index 000000000..821696717
--- /dev/null
+++ b/server/initializers/migrations/0150-avatar-cascade.ts
@@ -0,0 +1,28 @@
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 await utils.queryInterface.removeConstraint('actor', 'actor_avatarId_fkey')
9
10 await utils.queryInterface.addConstraint('actor', [ 'avatarId' ], {
11 type: 'foreign key',
12 references: {
13 table: 'avatar',
14 field: 'id'
15 },
16 onDelete: 'set null',
17 onUpdate: 'CASCADE'
18 })
19}
20
21function down (options) {
22 throw new Error('Not implemented.')
23}
24
25export {
26 up,
27 down
28}