2023-03-17 15:13:37 +00:00
|
|
|
import BaseSchema from '@ioc:Adonis/Lucid/Schema';
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
export default class Roles extends BaseSchema {
|
2023-04-24 11:03:36 +00:00
|
|
|
protected tableName = 'roles';
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2023-03-17 15:13:37 +00:00
|
|
|
public async up() {
|
|
|
|
this.schema.createTable(this.tableName, (table) => {
|
2023-04-24 11:03:36 +00:00
|
|
|
table.increments('id').primary().defaultTo("nextval('roles_id_seq')");
|
|
|
|
table.string('name', 255).notNullable();
|
|
|
|
table.string('display_name', 255);
|
|
|
|
table.string('description', 255);
|
|
|
|
table.timestamp('created_at', { useTz: false }).nullable();
|
|
|
|
table.timestamp('updated_at', { useTz: false }).nullable();
|
2023-03-17 15:13:37 +00:00
|
|
|
});
|
|
|
|
}
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2023-03-17 15:13:37 +00:00
|
|
|
public async down() {
|
|
|
|
this.schema.dropTable(this.tableName);
|
|
|
|
}
|
2023-03-03 15:54:28 +00:00
|
|
|
}
|
2023-04-24 11:03:36 +00:00
|
|
|
|
|
|
|
// CREATE TABLE IF NOT EXISTS roles
|
|
|
|
// (
|
|
|
|
// id integer NOT NULL DEFAULT nextval('roles_id_seq'::regclass),
|
|
|
|
// name character varying(255) NOT NULL,
|
|
|
|
// display_name character varying(255),
|
|
|
|
// description character varying(255),
|
|
|
|
// created_at timestamp(0) without time zone,
|
|
|
|
// updated_at timestamp(0) without time zone,
|
|
|
|
// CONSTRAINT roles_pkey PRIMARY KEY (id)
|
|
|
|
// )
|