Associating actors without network.

This commit is contained in:
2020-05-13 02:56:20 +02:00
parent 5a82e769c7
commit 6040a3f41f
53 changed files with 245 additions and 533 deletions

View File

@@ -253,13 +253,66 @@ exports.up = knex => Promise.resolve()
table.string('name')
.notNullable();
table.string('slug', 32)
.unique();
table.string('slug', 32);
table.integer('network_id', 12)
.references('id')
.inTable('networks');
table.unique(['slug', 'network_id']);
table.integer('alias_for', 12)
.references('id')
.inTable('actors');
table.date('birthdate');
table.string('gender', 18);
table.text('description');
table.string('birth_city');
table.string('birth_state');
table.string('birth_country_alpha2', 2)
.references('alpha2')
.inTable('countries');
table.string('residence_city');
table.string('residence_state');
table.string('residence_country_alpha2', 2)
.references('alpha2')
.inTable('countries');
table.string('ethnicity');
table.string('bust', 10);
table.integer('waist', 3);
table.integer('hip', 3);
table.boolean('natural_boobs');
table.integer('height', 3);
table.integer('weight', 3);
table.string('eyes');
table.string('hair');
table.boolean('has_tattoos');
table.boolean('has_piercings');
table.string('piercings');
table.string('tattoos');
table.integer('batch_id', 12);
table.datetime('updated_at')
.defaultTo(knex.fn.now());
table.datetime('created_at')
.defaultTo(knex.fn.now());
}))
.then(() => knex.schema.createTable('actors_profiles', (table) => {
table.increments('id', 12);
table.integer('actor_id', 12)
.references('id')
.inTable('actors');
table.integer('network_id', 12)
.references('id')
.inTable('networks');
@@ -297,22 +350,15 @@ exports.up = knex => Promise.resolve()
table.string('piercings');
table.string('tattoos');
table.datetime('scraped_at');
table.boolean('scrape_success');
table.datetime('updated_at')
.defaultTo(knex.fn.now());
table.datetime('created_at')
.defaultTo(knex.fn.now());
}))
.then(() => knex.raw('CREATE TABLE actors_profiles AS TABLE actors WITH NO DATA;'))
.then(() => knex.schema.alterTable('actors_profiles', (table) => {
table.integer('actor_id')
.references('id')
.inTable('actors')
.notNullable();
table.datetime('scraped_at');
table.boolean('scrape_success');
}))
.then(() => knex.schema.createTable('body', (table) => {
table.string('slug', 20)
.primary();
@@ -474,17 +520,17 @@ exports.up = knex => Promise.resolve()
.defaultTo(knex.fn.now());
}))
.then(() => knex.schema.createTable('actors_avatars', (table) => {
table.integer('actor_id', 12)
table.integer('profile_id', 12)
.notNullable()
.references('id')
.inTable('actors');
.inTable('actors_profiles');
table.string('media_id', 21)
.notNullable()
.references('id')
.inTable('media');
table.unique('actor_id');
table.unique('profile_id');
}))
.then(() => knex.schema.createTable('actors_photos', (table) => {
table.integer('actor_id', 12)