aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0415-thumbnail-auto-generated.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-01 16:54:24 +0200
committerChocobozzz <me@florianbigard.com>2019-08-01 16:54:24 +0200
commit65af03a241aa83ab7ba71278b6c99acd26428b8a (patch)
tree0cc04c31cdf631d11a915ae40389e8fa141f136b /server/initializers/migrations/0415-thumbnail-auto-generated.ts
parenta21e25ff641854c8b01664cb18655aa420620af6 (diff)
downloadPeerTube-65af03a241aa83ab7ba71278b6c99acd26428b8a.tar.gz
PeerTube-65af03a241aa83ab7ba71278b6c99acd26428b8a.tar.zst
PeerTube-65af03a241aa83ab7ba71278b6c99acd26428b8a.zip
Automatically update playlist thumbnails
Diffstat (limited to 'server/initializers/migrations/0415-thumbnail-auto-generated.ts')
-rw-r--r--server/initializers/migrations/0415-thumbnail-auto-generated.ts35
1 files changed, 35 insertions, 0 deletions
diff --git a/server/initializers/migrations/0415-thumbnail-auto-generated.ts b/server/initializers/migrations/0415-thumbnail-auto-generated.ts
new file mode 100644
index 000000000..f822a4c05
--- /dev/null
+++ b/server/initializers/migrations/0415-thumbnail-auto-generated.ts
@@ -0,0 +1,35 @@
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 const data = {
11 type: Sequelize.BOOLEAN,
12 allowNull: true,
13 defaultValue: null
14 }
15
16 await utils.queryInterface.addColumn('thumbnail', 'automaticallyGenerated', data)
17 }
18
19 {
20 // Set auto generated to true for watch later playlists
21 const query = 'UPDATE thumbnail SET "automaticallyGenerated" = true WHERE "videoPlaylistId" IN ' +
22 '(SELECT id FROM "videoPlaylist" WHERE type = 2)'
23
24 await utils.sequelize.query(query)
25 }
26}
27
28function down (options) {
29 throw new Error('Not implemented.')
30}
31
32export {
33 up,
34 down
35}