18 lines
537 B
TypeScript
18 lines
537 B
TypeScript
|
import { Knex } from 'knex';
|
||
|
|
||
|
export async function up(knex: Knex): Promise<void> {
|
||
|
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<void> {
|
||
|
return knex.schema.dropTable('user_privilege');
|
||
|
}
|