exports.up = async (knex) => { await knex.raw('CREATE UNIQUE INDEX unique_main_profiles ON actors_profiles (actor_id) WHERE (entity_id IS NULL);'); await knex.schema.createTable('actors_revisions', (table) => { table.increments('id'); table.integer('actor_id') .references('id') .inTable('actors') .onDelete('set null'); table.integer('profile_id') .references('id') .inTable('actors_profiles') .onDelete('set null'); table.integer('user_id') .references('id') .inTable('users') .onDelete('set null'); table.json('base') .notNullable(); table.json('deltas') .notNullable(); table.text('hash') .notNullable(); table.text('comment'); table.boolean('approved'); table.integer('reviewed_by') .references('id') .inTable('users') .onDelete('set null'); table.datetime('reviewed_at'); table.text('feedback'); table.datetime('applied_at'); table.datetime('created_at') .notNullable() .defaultTo(knex.fn.now()); }); await knex.schema.alterTable('actors', (table) => { table.integer('boobs_volume'); table.enum('boobs_implant', ['saline', 'silicone', 'gummy', 'fat']); table.enum('boobs_placement', ['over', 'under']); table.string('boobs_surgeon'); table.boolean('natural_butt'); table.integer('butt_volume'); table.enum('butt_implant', ['bbl', 'lift', 'silicone', 'lipo', 'filler', 'mms']); table.boolean('natural_lips'); table.integer('lips_volume'); }); await knex.schema.alterTable('actors_profiles', (table) => { table.integer('boobs_volume'); table.enum('boobs_implant', ['saline', 'silicone', 'gummy', 'fat']); table.enum('boobs_placement', ['over', 'under']); table.string('boobs_surgeon'); table.boolean('natural_butt'); table.integer('butt_volume'); table.enum('butt_implant', ['bbl', 'lift', 'silicone', 'lipo', 'filler', 'mms']); table.boolean('natural_lips'); table.integer('lips_volume'); }); }; exports.down = async (knex) => { await knex.raw('DROP INDEX unique_main_profiles;'); await knex.schema.dropTable('actors_revisions'); await knex.schema.alterTable('actors', (table) => { table.dropColumn('boobs_volume'); table.dropColumn('boobs_implant'); table.dropColumn('boobs_placement'); table.dropColumn('boobs_surgeon'); table.dropColumn('natural_butt'); table.dropColumn('butt_volume'); table.dropColumn('butt_implant'); table.dropColumn('natural_lips'); table.dropColumn('lips_volume'); }); await knex.schema.alterTable('actors_profiles', (table) => { table.dropColumn('boobs_volume'); table.dropColumn('boobs_implant'); table.dropColumn('boobs_placement'); table.dropColumn('boobs_surgeon'); table.dropColumn('natural_butt'); table.dropColumn('butt_volume'); table.dropColumn('butt_implant'); table.dropColumn('natural_lips'); table.dropColumn('lips_volume'); }); };