Fix video import with long thumbnail url

This commit is contained in:
Chocobozzz 2019-12-17 09:55:33 +01:00
parent 1a5fd848b4
commit 2735a154dc
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 46 additions and 4 deletions

View File

@ -14,7 +14,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
const LAST_MIGRATION_VERSION = 460 const LAST_MIGRATION_VERSION = 465
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -291,6 +291,9 @@ const CONSTRAINTS_FIELDS = {
PLUGINS: { PLUGINS: {
NAME: { min: 1, max: 214 }, // Length NAME: { min: 1, max: 214 }, // Length
DESCRIPTION: { min: 1, max: 20000 } // Length DESCRIPTION: { min: 1, max: 20000 } // Length
},
COMMONS: {
URL: { min: 5, max: 2000 } // Length
} }
} }

View File

@ -0,0 +1,27 @@
import * as Sequelize from 'sequelize'
async function up (utils: {
transaction: Sequelize.Transaction,
queryInterface: Sequelize.QueryInterface,
sequelize: Sequelize.Sequelize,
db: any
}): Promise<void> {
{
const data = {
type: Sequelize.STRING(2000),
allowNull: true,
defaultValue: null
}
await utils.queryInterface.changeColumn('thumbnail', 'fileUrl', data)
}
}
function down (options) {
throw new Error('Not implemented.')
}
export {
up,
down
}

View File

@ -1,6 +1,18 @@
import { join } from 'path' import { join } from 'path'
import { AfterDestroy, AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript' import {
import { LAZY_STATIC_PATHS, STATIC_PATHS, WEBSERVER } from '../../initializers/constants' AfterDestroy,
AllowNull,
BelongsTo,
Column,
CreatedAt,
DataType,
Default,
ForeignKey,
Model,
Table,
UpdatedAt
} from 'sequelize-typescript'
import { CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, STATIC_PATHS, WEBSERVER } from '../../initializers/constants'
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'
import { remove } from 'fs-extra' import { remove } from 'fs-extra'
import { CONFIG } from '../../initializers/config' import { CONFIG } from '../../initializers/config'
@ -41,7 +53,7 @@ export class ThumbnailModel extends Model<ThumbnailModel> {
type: ThumbnailType type: ThumbnailType
@AllowNull(true) @AllowNull(true)
@Column @Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))
fileUrl: string fileUrl: string
@AllowNull(true) @AllowNull(true)