diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-12-04 10:34:40 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-12-04 10:34:40 +0100 |
commit | 2295ce6c4e7ba805cc100ff961527bebc2cd89e5 (patch) | |
tree | fce0a24074ac119aad730ef5c73c680500ff9578 /server/initializers/migrations | |
parent | 202f6b6c9dcc9b0aec4b0c1b15e455c22a7952a7 (diff) | |
download | PeerTube-2295ce6c4e7ba805cc100ff961527bebc2cd89e5.tar.gz PeerTube-2295ce6c4e7ba805cc100ff961527bebc2cd89e5.tar.zst PeerTube-2295ce6c4e7ba805cc100ff961527bebc2cd89e5.zip |
Add account avatar
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r-- | server/initializers/migrations/0115-account-avatar.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/server/initializers/migrations/0115-account-avatar.ts b/server/initializers/migrations/0115-account-avatar.ts new file mode 100644 index 000000000..e3531f5ce --- /dev/null +++ b/server/initializers/migrations/0115-account-avatar.ts | |||
@@ -0,0 +1,31 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | import { PeerTubeDatabase } from '../database' | ||
3 | |||
4 | async function up (utils: { | ||
5 | transaction: Sequelize.Transaction, | ||
6 | queryInterface: Sequelize.QueryInterface, | ||
7 | sequelize: Sequelize.Sequelize, | ||
8 | db: PeerTubeDatabase | ||
9 | }): Promise<void> { | ||
10 | await db.Avatar.sync() | ||
11 | |||
12 | const data = { | ||
13 | type: Sequelize.INTEGER, | ||
14 | allowNull: true, | ||
15 | references: { | ||
16 | model: 'Avatars', | ||
17 | key: 'id' | ||
18 | }, | ||
19 | onDelete: 'CASCADE' | ||
20 | } | ||
21 | await utils.queryInterface.addColumn('Accounts', 'avatarId', data) | ||
22 | } | ||
23 | |||
24 | function down (options) { | ||
25 | throw new Error('Not implemented.') | ||
26 | } | ||
27 | |||
28 | export { | ||
29 | up, | ||
30 | down | ||
31 | } | ||