aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0085-user-role.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-21 14:54:29 +0100
committerChocobozzz <me@florianbigard.com>2022-03-21 14:54:29 +0100
commit348c2ce3ff3fe2f25a31f08bfb36c88723a0ce46 (patch)
tree972ec51091bab14e7671ef7db3b6e43ea5f116f7 /server/initializers/migrations/0085-user-role.ts
parente6afb669402aead6bf3d9d7ba4f2bd434c831eab (diff)
downloadPeerTube-348c2ce3ff3fe2f25a31f08bfb36c88723a0ce46.tar.gz
PeerTube-348c2ce3ff3fe2f25a31f08bfb36c88723a0ce46.tar.zst
PeerTube-348c2ce3ff3fe2f25a31f08bfb36c88723a0ce46.zip
Remove old migration files
Diffstat (limited to 'server/initializers/migrations/0085-user-role.ts')
-rw-r--r--server/initializers/migrations/0085-user-role.ts38
1 files changed, 0 insertions, 38 deletions
diff --git a/server/initializers/migrations/0085-user-role.ts b/server/initializers/migrations/0085-user-role.ts
deleted file mode 100644
index ec7428fd5..000000000
--- a/server/initializers/migrations/0085-user-role.ts
+++ /dev/null
@@ -1,38 +0,0 @@
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 const q = utils.queryInterface
10
11 await q.renameColumn('Users', 'role', 'oldRole')
12
13 const data = {
14 type: Sequelize.INTEGER,
15 allowNull: true
16 }
17 await q.addColumn('Users', 'role', data)
18
19 let query = 'UPDATE "Users" SET "role" = 0 WHERE "oldRole" = \'admin\''
20 await utils.sequelize.query(query)
21
22 query = 'UPDATE "Users" SET "role" = 2 WHERE "oldRole" = \'user\''
23 await utils.sequelize.query(query)
24
25 data.allowNull = false
26 await q.changeColumn('Users', 'role', data)
27
28 await q.removeColumn('Users', 'oldRole')
29}
30
31function down (options) {
32 throw new Error('Not implemented.')
33}
34
35export {
36 up,
37 down
38}