feat: Introduce role column to user model
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { Knex } from 'knex';
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
return knex.schema.table('users', async (table) => {
|
||||
table.string('role');
|
||||
|
||||
await knex('users').update({ role: 'admin' });
|
||||
});
|
||||
}
|
||||
|
||||
export async function down(knex: Knex): Promise<void> {
|
||||
return knex.schema.table('users', (table) => {
|
||||
table.dropColumn('role');
|
||||
});
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
import { Knex } from 'knex';
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
return knex.schema.alterTable('users', (table) => {
|
||||
table.string('role').notNullable().alter();
|
||||
});
|
||||
}
|
||||
|
||||
export async function down(knex: Knex): Promise<void> {
|
||||
return knex.schema.alterTable('users', (table) => {
|
||||
table.string('role').nullable().alter();
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user