import { Knex } from 'knex'; export async function up(knex: Knex): Promise { return knex.schema.createTable('user_privilege', (table) => { table.integer('privilege_id').nullable().unsigned(); table.uuid('user_id').nullable(); table .foreign('privilege_id') .references('privileges.id') .onDelete('CASCADE'); table.foreign('user_id').references('users.id').onDelete('CASCADE'); }); } export async function down(knex: Knex): Promise { return knex.schema.dropTable('user_privilege'); }