- add all migration files for database

- npm updates
This commit is contained in:
Kaimbacher 2023-04-24 13:03:36 +02:00
parent 8a404e8a0c
commit 4abcfe7135
29 changed files with 1540 additions and 375 deletions

View file

@ -1,21 +1,16 @@
import BaseSchema from '@ioc:Adonis/Lucid/Schema';
import Config from '@ioc:Adonis/Core/Config';
export default class Roles extends BaseSchema {
protected tableName = Config.get('rolePermission.role_table', 'roles');
protected tableName = 'roles';
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id');
table.string('name', 191).unique();
table.string('slug', 191).nullable().unique();
table.string('description', 191).nullable();
/**
* Uses timestamptz for PostgreSQL and DATETIME2 for MSSQL
*/
table.timestamp('created_at', { useTz: true }).nullable();
table.timestamp('updated_at', { useTz: true }).nullable();
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();
});
}
@ -23,3 +18,19 @@ export default class Roles extends BaseSchema {
this.schema.dropTable(this.tableName);
}
}
// 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)
// )
// ALTER TABLE IF EXISTS roles
// OWNER to tethys_admin;
// REVOKE ALL ON TABLE roles FROM tethys_app;
// GRANT ALL ON TABLE roles TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE roles TO tethys_app;