aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations
diff options
context:
space:
mode:
authorBRAINS YUM <43896676+McFlat@users.noreply.github.com>2018-10-19 01:54:01 -0500
committerChocobozzz <me@florianbigard.com>2018-10-19 08:54:01 +0200
commitd23e6a1c97a6ae3ca8d340a8c9adad268a5be57e (patch)
treee5a11500d446b585716d451dd274e8567d36cd2a /server/initializers/migrations
parente0628695c3425bf69b5d7a46b24dcdf31892d9b6 (diff)
downloadPeerTube-d23e6a1c97a6ae3ca8d340a8c9adad268a5be57e.tar.gz
PeerTube-d23e6a1c97a6ae3ca8d340a8c9adad268a5be57e.tar.zst
PeerTube-d23e6a1c97a6ae3ca8d340a8c9adad268a5be57e.zip
Feature/description support fields length 1000 (#1267)
* fix migrations to not use config constant values as it can introduce bugs later when they change; (fixes #1259) remove constant fields imports from migrations * add migrations to update description and support fields to 1000 (fixes #1258) * fix client/server account and video_channel description/support fields to be max len 1000 (fixes #1258); fix test Should fail with a too long description; fix test Should fail with a long description; fix test Should fail with a long description; Remove USER.SUPPORT from constants since that field no longer exists; null not false, in migrations/0280-description-support.ts; video support field 1000, oops; * rename migration 0280-description-support.ts -> 0285-description-support.ts; update video support maxlength text
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r--server/initializers/migrations/0120-video-null.ts3
-rw-r--r--server/initializers/migrations/0195-support.ts9
-rw-r--r--server/initializers/migrations/0245-user-blocked.ts3
-rw-r--r--server/initializers/migrations/0250-video-abuse-state.ts3
-rw-r--r--server/initializers/migrations/0255-video-blacklist-reason.ts3
-rw-r--r--server/initializers/migrations/0260-upload-quota-daily.ts1
-rw-r--r--server/initializers/migrations/0285-description-support.ts53
7 files changed, 61 insertions, 14 deletions
diff --git a/server/initializers/migrations/0120-video-null.ts b/server/initializers/migrations/0120-video-null.ts
index 63f3984dd..6d253f04f 100644
--- a/server/initializers/migrations/0120-video-null.ts
+++ b/server/initializers/migrations/0120-video-null.ts
@@ -1,5 +1,4 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { CONSTRAINTS_FIELDS } from '../constants'
3 2
4async function up (utils: { 3async function up (utils: {
5 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction,
@@ -28,7 +27,7 @@ async function up (utils: {
28 27
29 { 28 {
30 const data = { 29 const data = {
31 type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max), 30 type: Sequelize.STRING(10000),
32 allowNull: true, 31 allowNull: true,
33 defaultValue: null 32 defaultValue: null
34 } 33 }
diff --git a/server/initializers/migrations/0195-support.ts b/server/initializers/migrations/0195-support.ts
index 8722a5f22..3b9eabe79 100644
--- a/server/initializers/migrations/0195-support.ts
+++ b/server/initializers/migrations/0195-support.ts
@@ -1,5 +1,4 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { CONSTRAINTS_FIELDS } from '../index'
3 2
4async function up (utils: { 3async function up (utils: {
5 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction,
@@ -8,7 +7,7 @@ async function up (utils: {
8}): Promise<void> { 7}): Promise<void> {
9 { 8 {
10 const data = { 9 const data = {
11 type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.SUPPORT.max), 10 type: Sequelize.STRING(500),
12 allowNull: true, 11 allowNull: true,
13 defaultValue: null 12 defaultValue: null
14 } 13 }
@@ -17,7 +16,7 @@ async function up (utils: {
17 16
18 { 17 {
19 const data = { 18 const data = {
20 type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.SUPPORT.max), 19 type: Sequelize.STRING(500),
21 allowNull: true, 20 allowNull: true,
22 defaultValue: null 21 defaultValue: null
23 } 22 }
@@ -26,7 +25,7 @@ async function up (utils: {
26 25
27 { 26 {
28 const data = { 27 const data = {
29 type: Sequelize.STRING(CONSTRAINTS_FIELDS.USERS.DESCRIPTION.max), 28 type: Sequelize.STRING(250),
30 allowNull: true, 29 allowNull: true,
31 defaultValue: null 30 defaultValue: null
32 } 31 }
@@ -35,7 +34,7 @@ async function up (utils: {
35 34
36 { 35 {
37 const data = { 36 const data = {
38 type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max), 37 type: Sequelize.STRING(10000),
39 allowNull: true, 38 allowNull: true,
40 defaultValue: null 39 defaultValue: null
41 } 40 }
diff --git a/server/initializers/migrations/0245-user-blocked.ts b/server/initializers/migrations/0245-user-blocked.ts
index 5a04ecd2b..19c7d5b9c 100644
--- a/server/initializers/migrations/0245-user-blocked.ts
+++ b/server/initializers/migrations/0245-user-blocked.ts
@@ -1,5 +1,4 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { CONSTRAINTS_FIELDS } from '../constants'
3 2
4async function up (utils: { 3async function up (utils: {
5 transaction: Sequelize.Transaction 4 transaction: Sequelize.Transaction
@@ -31,7 +30,7 @@ async function up (utils: {
31 30
32 { 31 {
33 const data = { 32 const data = {
34 type: Sequelize.STRING(CONSTRAINTS_FIELDS.USERS.BLOCKED_REASON.max), 33 type: Sequelize.STRING(250),
35 allowNull: true, 34 allowNull: true,
36 defaultValue: null 35 defaultValue: null
37 } 36 }
diff --git a/server/initializers/migrations/0250-video-abuse-state.ts b/server/initializers/migrations/0250-video-abuse-state.ts
index acb668ae1..50de25182 100644
--- a/server/initializers/migrations/0250-video-abuse-state.ts
+++ b/server/initializers/migrations/0250-video-abuse-state.ts
@@ -1,5 +1,4 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { CONSTRAINTS_FIELDS } from '../constants'
3import { VideoAbuseState } from '../../../shared/models/videos' 2import { VideoAbuseState } from '../../../shared/models/videos'
4 3
5async function up (utils: { 4async function up (utils: {
@@ -32,7 +31,7 @@ async function up (utils: {
32 31
33 { 32 {
34 const data = { 33 const data = {
35 type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEO_ABUSES.MODERATION_COMMENT.max), 34 type: Sequelize.STRING(300),
36 allowNull: true, 35 allowNull: true,
37 defaultValue: null 36 defaultValue: null
38 } 37 }
diff --git a/server/initializers/migrations/0255-video-blacklist-reason.ts b/server/initializers/migrations/0255-video-blacklist-reason.ts
index a380e620e..69d6efb9e 100644
--- a/server/initializers/migrations/0255-video-blacklist-reason.ts
+++ b/server/initializers/migrations/0255-video-blacklist-reason.ts
@@ -1,5 +1,4 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { CONSTRAINTS_FIELDS } from '../constants'
3import { VideoAbuseState } from '../../../shared/models/videos' 2import { VideoAbuseState } from '../../../shared/models/videos'
4 3
5async function up (utils: { 4async function up (utils: {
@@ -10,7 +9,7 @@ async function up (utils: {
10 9
11 { 10 {
12 const data = { 11 const data = {
13 type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEO_BLACKLIST.REASON.max), 12 type: Sequelize.STRING(300),
14 allowNull: true, 13 allowNull: true,
15 defaultValue: null 14 defaultValue: null
16 } 15 }
diff --git a/server/initializers/migrations/0260-upload-quota-daily.ts b/server/initializers/migrations/0260-upload-quota-daily.ts
index d25154ba6..cbbe391ef 100644
--- a/server/initializers/migrations/0260-upload-quota-daily.ts
+++ b/server/initializers/migrations/0260-upload-quota-daily.ts
@@ -1,5 +1,4 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { CONSTRAINTS_FIELDS } from '../constants'
3 2
4async function up (utils: { 3async function up (utils: {
5 transaction: Sequelize.Transaction 4 transaction: Sequelize.Transaction
diff --git a/server/initializers/migrations/0285-description-support.ts b/server/initializers/migrations/0285-description-support.ts
new file mode 100644
index 000000000..85ef4ef39
--- /dev/null
+++ b/server/initializers/migrations/0285-description-support.ts
@@ -0,0 +1,53 @@
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.STRING(1000),
12 allowNull: true,
13 defaultValue: null
14 }
15 await utils.queryInterface.changeColumn('video', 'support', data)
16 }
17
18 {
19 const data = {
20 type: Sequelize.STRING(1000),
21 allowNull: true,
22 defaultValue: null
23 }
24 await utils.queryInterface.changeColumn('videoChannel', 'support', data)
25 }
26
27 {
28 const data = {
29 type: Sequelize.STRING(1000),
30 allowNull: true,
31 defaultValue: null
32 }
33 await utils.queryInterface.changeColumn('videoChannel', 'description', data)
34 }
35
36 {
37 const data = {
38 type: Sequelize.STRING(1000),
39 allowNull: true,
40 defaultValue: null
41 }
42 await utils.queryInterface.changeColumn('account', 'description', data)
43 }
44}
45
46function down (options) {
47 throw new Error('Not implemented.')
48}
49
50export {
51 up,
52 down
53}