Refactored clips into chapters.

This commit is contained in:
DebaucheryLibrarian
2021-02-27 00:37:22 +01:00
parent 0eba0461c9
commit bb20659934
115 changed files with 671 additions and 194 deletions

View File

@@ -903,7 +903,7 @@ exports.up = knex => Promise.resolve()
table.unique('movie_id');
}))
.then(() => knex.schema.createTable('clips', (table) => {
.then(() => knex.schema.createTable('chapters', (table) => {
table.increments('id', 16);
table.integer('release_id', 12)
@@ -912,16 +912,18 @@ exports.up = knex => Promise.resolve()
.notNullable()
.onDelete('cascade');
table.integer('clip', 6);
table.integer('index');
table.unique(['release_id', 'index']);
table.unique(['release_id', 'clip']);
table.text('title');
table.text('description');
table.integer('time')
.unsigned();
table.integer('duration')
.unsigned();
table.text('title');
table.text('description');
table.integer('created_batch_id', 12)
.references('id')
.inTable('batches')
@@ -935,11 +937,11 @@ exports.up = knex => Promise.resolve()
table.datetime('created_at')
.defaultTo(knex.fn.now());
}))
.then(() => knex.schema.createTable('clips_posters', (table) => {
table.integer('clip_id', 16)
.then(() => knex.schema.createTable('chapters_posters', (table) => {
table.integer('chapter_id', 16)
.notNullable()
.references('id')
.inTable('clips')
.inTable('chapters')
.onDelete('cascade');
table.text('media_id', 21)
@@ -947,13 +949,13 @@ exports.up = knex => Promise.resolve()
.references('id')
.inTable('media');
table.unique('clip_id');
table.unique('chapter_id');
}))
.then(() => knex.schema.createTable('clips_photos', (table) => {
table.integer('clip_id', 16)
.then(() => knex.schema.createTable('chapters_photos', (table) => {
table.integer('chapter_id', 16)
.notNullable()
.references('id')
.inTable('clips')
.inTable('chapters')
.onDelete('cascade');
table.text('media_id', 21)
@@ -961,21 +963,22 @@ exports.up = knex => Promise.resolve()
.references('id')
.inTable('media');
table.unique(['clip_id', 'media_id']);
table.unique(['chapter_id', 'media_id']);
}))
.then(() => knex.schema.createTable('clips_tags', (table) => {
.then(() => knex.schema.createTable('chapters_tags', (table) => {
table.integer('tag_id', 12)
.notNullable()
.references('id')
.inTable('tags')
.onDelete('cascade');
table.integer('clip_id', 16)
table.integer('chapter_id', 16)
.notNullable()
.references('id')
.inTable('clips');
.inTable('chapters')
.onDelete('cascade');
table.unique(['tag_id', 'clip_id']);
table.unique(['tag_id', 'chapter_id']);
}))
// SEARCH
.then(() => { // eslint-disable-line arrow-body-style
@@ -1207,6 +1210,10 @@ exports.down = (knex) => { // eslint-disable-line arrow-body-style
DROP TABLE IF EXISTS clips_posters CASCADE;
DROP TABLE IF EXISTS clips_photos CASCADE;
DROP TABLE IF EXISTS chapters_tags CASCADE;
DROP TABLE IF EXISTS chapters_posters CASCADE;
DROP TABLE IF EXISTS chapters_photos CASCADE;
DROP TABLE IF EXISTS batches CASCADE;
DROP TABLE IF EXISTS actors_avatars CASCADE;
@@ -1226,6 +1233,7 @@ exports.down = (knex) => { // eslint-disable-line arrow-body-style
DROP TABLE IF EXISTS tags_photos CASCADE;
DROP TABLE IF EXISTS movies CASCADE;
DROP TABLE IF EXISTS clips CASCADE;
DROP TABLE IF EXISTS chapters CASCADE;
DROP TABLE IF EXISTS releases CASCADE;
DROP TABLE IF EXISTS actors CASCADE;
DROP TABLE IF EXISTS directors CASCADE;