diff options
author | kontrollanten <6680299+kontrollanten@users.noreply.github.com> | 2022-06-21 15:31:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-21 15:31:25 +0200 |
commit | 2e401e8575decb1d491d0db48ca1ab1eba5b2a66 (patch) | |
tree | eee1e6213ca4d635837ca01c2bdc5c876b8d8b7d /server/initializers/migrations/0715-video-source.ts | |
parent | dec49521556fc228c6e05b6199e9b07f619b38fb (diff) | |
download | PeerTube-2e401e8575decb1d491d0db48ca1ab1eba5b2a66.tar.gz PeerTube-2e401e8575decb1d491d0db48ca1ab1eba5b2a66.tar.zst PeerTube-2e401e8575decb1d491d0db48ca1ab1eba5b2a66.zip |
store uploaded video filename (#4885)
* store uploaded video filename
closes #4731
* dont crash if videos channel exist
* migration: use raw query
* video source: fixes after code review
* cleanup
* bump migration
* updates after code review
* refactor: use checkUserCanManageVideo
* videoSource: add openapi doc
* test(check-params/video-source): fix timeout
* Styling
* Correctly set original filename as source
Co-authored-by: Chocobozzz <me@florianbigard.com>
Diffstat (limited to 'server/initializers/migrations/0715-video-source.ts')
-rw-r--r-- | server/initializers/migrations/0715-video-source.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/server/initializers/migrations/0715-video-source.ts b/server/initializers/migrations/0715-video-source.ts new file mode 100644 index 000000000..efcf77ebd --- /dev/null +++ b/server/initializers/migrations/0715-video-source.ts | |||
@@ -0,0 +1,34 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | async function up (utils: { | ||
4 | transaction: Sequelize.Transaction | ||
5 | queryInterface: Sequelize.QueryInterface | ||
6 | sequelize: Sequelize.Sequelize | ||
7 | db: any | ||
8 | }): Promise<void> { | ||
9 | { | ||
10 | const query = ` | ||
11 | CREATE TABLE IF NOT EXISTS "videoSource" ( | ||
12 | "id" SERIAL , | ||
13 | "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, | ||
14 | "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, | ||
15 | "filename" VARCHAR(255) DEFAULT NULL, | ||
16 | "videoId" INTEGER | ||
17 | REFERENCES "video" ("id") | ||
18 | ON DELETE CASCADE | ||
19 | ON UPDATE CASCADE, | ||
20 | PRIMARY KEY ("id") | ||
21 | ); | ||
22 | ` | ||
23 | await utils.sequelize.query(query) | ||
24 | } | ||
25 | } | ||
26 | |||
27 | function down (options) { | ||
28 | throw new Error('Not implemented.') | ||
29 | } | ||
30 | |||
31 | export { | ||
32 | up, | ||
33 | down | ||
34 | } | ||