diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-18 11:28:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-24 16:26:20 +0200 |
commit | 1735c825726edaa0af5035cb6cbb0cc0db502c6d (patch) | |
tree | 7bbb442f2cb4d7be58a4e08d87f5974403a3047c /server/initializers/migrations | |
parent | e8bafea35bc930cb8ac5b2d521a188642a1adffe (diff) | |
download | PeerTube-1735c825726edaa0af5035cb6cbb0cc0db502c6d.tar.gz PeerTube-1735c825726edaa0af5035cb6cbb0cc0db502c6d.tar.zst PeerTube-1735c825726edaa0af5035cb6cbb0cc0db502c6d.zip |
Update sequelize
Diffstat (limited to 'server/initializers/migrations')
4 files changed, 11 insertions, 8 deletions
diff --git a/server/initializers/migrations/0080-video-channels.ts b/server/initializers/migrations/0080-video-channels.ts index 0e17a4ccd..5512bdcf1 100644 --- a/server/initializers/migrations/0080-video-channels.ts +++ b/server/initializers/migrations/0080-video-channels.ts | |||
@@ -69,7 +69,7 @@ async function up (utils: { | |||
69 | const options = { | 69 | const options = { |
70 | type: Sequelize.QueryTypes.SELECT | 70 | type: Sequelize.QueryTypes.SELECT |
71 | } | 71 | } |
72 | const rawVideos = await utils.sequelize.query(query, options) | 72 | const rawVideos = await utils.sequelize.query(query, options) as any |
73 | 73 | ||
74 | for (const rawVideo of rawVideos) { | 74 | for (const rawVideo of rawVideos) { |
75 | const videoChannel = await utils.db.VideoChannel.findOne({ where: { authorId: rawVideo.authorId } }) | 75 | const videoChannel = await utils.db.VideoChannel.findOne({ where: { authorId: rawVideo.authorId } }) |
diff --git a/server/initializers/migrations/0100-activitypub.ts b/server/initializers/migrations/0100-activitypub.ts index a7ebd804c..2880a97d9 100644 --- a/server/initializers/migrations/0100-activitypub.ts +++ b/server/initializers/migrations/0100-activitypub.ts | |||
@@ -21,7 +21,7 @@ async function up (utils: { | |||
21 | const options = { | 21 | const options = { |
22 | type: Sequelize.QueryTypes.SELECT | 22 | type: Sequelize.QueryTypes.SELECT |
23 | } | 23 | } |
24 | const res = await utils.sequelize.query(query, options) | 24 | const res = await utils.sequelize.query(query, options) as any |
25 | 25 | ||
26 | if (!res[0] || res[0].total !== 0) { | 26 | if (!res[0] || res[0].total !== 0) { |
27 | throw new Error('You need to quit friends.') | 27 | throw new Error('You need to quit friends.') |
@@ -68,8 +68,8 @@ async function up (utils: { | |||
68 | const accountCreated = await createLocalAccountWithoutKeys(SERVER_ACTOR_NAME, null, applicationInstance.id, undefined) | 68 | const accountCreated = await createLocalAccountWithoutKeys(SERVER_ACTOR_NAME, null, applicationInstance.id, undefined) |
69 | 69 | ||
70 | const { publicKey, privateKey } = await createPrivateAndPublicKeys() | 70 | const { publicKey, privateKey } = await createPrivateAndPublicKeys() |
71 | accountCreated.set('publicKey', publicKey) | 71 | accountCreated.Actor.publicKey = publicKey |
72 | accountCreated.set('privateKey', privateKey) | 72 | accountCreated.Actor.privateKey = privateKey |
73 | 73 | ||
74 | await accountCreated.save() | 74 | await accountCreated.save() |
75 | } | 75 | } |
@@ -86,8 +86,8 @@ async function up (utils: { | |||
86 | const account = await createLocalAccountWithoutKeys(user.username, user.id, null, undefined) | 86 | const account = await createLocalAccountWithoutKeys(user.username, user.id, null, undefined) |
87 | 87 | ||
88 | const { publicKey, privateKey } = await createPrivateAndPublicKeys() | 88 | const { publicKey, privateKey } = await createPrivateAndPublicKeys() |
89 | account.set('publicKey', publicKey) | 89 | account.Actor.publicKey = publicKey |
90 | account.set('privateKey', privateKey) | 90 | account.Actor.privateKey = privateKey |
91 | await account.save() | 91 | await account.save() |
92 | } | 92 | } |
93 | 93 | ||
diff --git a/server/initializers/migrations/0135-video-channel-actor.ts b/server/initializers/migrations/0135-video-channel-actor.ts index 033f43b68..5ace0f4d2 100644 --- a/server/initializers/migrations/0135-video-channel-actor.ts +++ b/server/initializers/migrations/0135-video-channel-actor.ts | |||
@@ -239,7 +239,8 @@ async function up (utils: { | |||
239 | 239 | ||
240 | { | 240 | { |
241 | const query = 'SELECT * FROM "actor" WHERE "serverId" IS NULL AND "publicKey" IS NULL' | 241 | const query = 'SELECT * FROM "actor" WHERE "serverId" IS NULL AND "publicKey" IS NULL' |
242 | const [ res ] = await utils.sequelize.query(query) | 242 | const options = { type: Sequelize.QueryTypes.SELECT as Sequelize.QueryTypes.SELECT } |
243 | const [ res ] = await utils.sequelize.query(query, options) | ||
243 | 244 | ||
244 | for (const actor of res) { | 245 | for (const actor of res) { |
245 | const { privateKey, publicKey } = await createPrivateAndPublicKeys() | 246 | const { privateKey, publicKey } = await createPrivateAndPublicKeys() |
diff --git a/server/initializers/migrations/0345-video-playlists.ts b/server/initializers/migrations/0345-video-playlists.ts index 6953f5553..de69f5b9e 100644 --- a/server/initializers/migrations/0345-video-playlists.ts +++ b/server/initializers/migrations/0345-video-playlists.ts | |||
@@ -51,7 +51,9 @@ CREATE TABLE IF NOT EXISTS "videoPlaylistElement" | |||
51 | 51 | ||
52 | { | 52 | { |
53 | const userQuery = 'SELECT "username" FROM "user";' | 53 | const userQuery = 'SELECT "username" FROM "user";' |
54 | const userResult = await utils.sequelize.query(userQuery, { transaction, type: Sequelize.QueryTypes.SELECT }) | 54 | |
55 | const options = { transaction, type: Sequelize.QueryTypes.SELECT as Sequelize.QueryTypes.SELECT } | ||
56 | const userResult = await utils.sequelize.query<{ username: string }>(userQuery, options) | ||
55 | const usernames = userResult.map(r => r.username) | 57 | const usernames = userResult.map(r => r.username) |
56 | 58 | ||
57 | for (const username of usernames) { | 59 | for (const username of usernames) { |