Improved scraping and association behavior.

This commit is contained in:
2019-11-19 04:36:15 +01:00
parent 7e9fd19c2a
commit 3ec7b15886
10 changed files with 166 additions and 94 deletions

View File

@@ -53,6 +53,9 @@ exports.up = knex => Promise.resolve()
table.datetime('created_at')
.defaultTo(knex.fn.now());
table.datetime('scraped_at');
table.boolean('scrape_success');
}))
.then(() => knex.schema.createTable('directors', (table) => {
table.increments('id', 12);
@@ -229,6 +232,8 @@ exports.up = knex => Promise.resolve()
.notNullable()
.references('id')
.inTable('actors');
table.unique(['release_id', 'actor_id']);
}))
.then(() => knex.schema.createTable('directors_associated', (table) => {
table.increments('id', 16);
@@ -242,6 +247,8 @@ exports.up = knex => Promise.resolve()
.notNullable()
.references('id')
.inTable('directors');
table.unique(['release_id', 'director_id']);
}))
.then(() => knex.schema.createTable('tags_associated', (table) => {
table.integer('tag_id', 12)
@@ -256,6 +263,9 @@ exports.up = knex => Promise.resolve()
table.integer('release_id', 16)
.references('id')
.inTable('releases');
table.unique(['release_id', 'tag_id']);
table.unique(['site_id', 'tag_id']);
}));
exports.down = knex => Promise.resolve()