traxxx/migrations/20260207034922_chapter_deta...

59 lines
1.3 KiB
JavaScript

exports.up = async function(knex) {
await knex.schema.alterTable('chapters', (table) => {
table.datetime('date');
});
await knex.schema.createTable('chapters_trailers', (table) => {
table.integer('chapter_id')
.notNullable()
.references('id')
.inTable('chapters')
.onDelete('cascade');
table.text('media_id')
.notNullable()
.references('id')
.inTable('media')
.onDelete('cascade');
});
await knex.schema.createTable('chapters_teasers', (table) => {
table.integer('chapter_id')
.notNullable()
.references('id')
.inTable('chapters')
.onDelete('cascade');
table.text('media_id')
.notNullable()
.references('id')
.inTable('media')
.onDelete('cascade');
});
await knex.schema.alterTable('entities', (table) => {
table.string('name_stylized');
});
await knex.schema.alterTable('movies', (table) => {
table.specificType('alt_descriptions', 'text ARRAY');
});
};
exports.down = async function(knex) {
await knex.schema.alterTable('chapters', (table) => {
table.dropColumn('date');
});
await knex.schema.alterTable('entities', (table) => {
table.dropColumn('name_stylized');
});
await knex.schema.dropTable('chapters_trailers');
await knex.schema.dropTable('chapters_teasers');
await knex.schema.alterTable('movies', (table) => {
table.dropColumn('alt_descriptions');
});
};