1
0
Fork 0
peertube/server/initializers/migrations/0800-video-replace-file.ts
2023-07-21 17:38:13 +02:00

38 lines
815 B
TypeScript

import * as Sequelize from 'sequelize'
async function up (utils: {
transaction: Sequelize.Transaction
queryInterface: Sequelize.QueryInterface
sequelize: Sequelize.Sequelize
}): Promise<void> {
const { transaction } = utils
{
const query = 'DELETE FROM "videoSource" WHERE "videoId" IS NULL'
await utils.sequelize.query(query, { transaction })
}
{
const query = 'ALTER TABLE "videoSource" ALTER COLUMN "videoId" SET NOT NULL'
await utils.sequelize.query(query, { transaction })
}
{
const data = {
type: Sequelize.DATE,
allowNull: true,
defaultValue: null
}
await utils.queryInterface.addColumn('video', 'inputFileUpdatedAt', data, { transaction })
}
}
function down (options) {
throw new Error('Not implemented.')
}
export {
up,
down
}