- add all migration files for database
- npm updates
This commit is contained in:
parent
8a404e8a0c
commit
4abcfe7135
29 changed files with 1540 additions and 375 deletions
|
@ -1,25 +1,39 @@
|
|||
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
|
||||
import Config from '@ioc:Adonis/Core/Config'
|
||||
import BaseSchema from '@ioc:Adonis/Lucid/Schema';
|
||||
|
||||
export default class Permissions extends BaseSchema {
|
||||
protected tableName = Config.get('rolePermission.permission_table', 'permissions')
|
||||
protected tableName = 'permissions';
|
||||
|
||||
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()
|
||||
public async up() {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.increments('id').primary().defaultTo("nextval('permissions_id_seq')");
|
||||
table.string('name', 255).unique().notNullable();
|
||||
table.string('display_name', 100).notNullable();
|
||||
table.string('description', 255);
|
||||
// table.timestamp('created_at');
|
||||
// table.timestamp('updated_at');
|
||||
table.timestamp('created_at', { useTz: false });
|
||||
table.timestamp('updated_at', { useTz: false });
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses timestamptz for PostgreSQL and DATETIME2 for MSSQL
|
||||
*/
|
||||
table.timestamp('created_at', { useTz: true }).nullable()
|
||||
table.timestamp('updated_at', { useTz: true }).nullable()
|
||||
})
|
||||
}
|
||||
|
||||
public async down() {
|
||||
this.schema.dropTable(this.tableName)
|
||||
}
|
||||
public async down() {
|
||||
this.schema.dropTableIfExists(this.tableName);
|
||||
}
|
||||
}
|
||||
|
||||
// CREATE TABLE IF NOT EXISTS permissions
|
||||
// (
|
||||
// id integer NOT NULL DEFAULT nextval('permissions_id_seq'::regclass),
|
||||
// name character varying(255) NOT NULL,
|
||||
// display_name character varying(100) NOT NULL,
|
||||
// description character varying(255),
|
||||
// created_at timestamp(0) without time zone,
|
||||
// updated_at timestamp(0) without time zone,
|
||||
// CONSTRAINT permissions_pkey PRIMARY KEY (id),
|
||||
// CONSTRAINT permissions_name_unique UNIQUE (name)
|
||||
// )
|
||||
// ALTER TABLE IF EXISTS permissions
|
||||
// OWNER to tethys_admin;
|
||||
// REVOKE ALL ON TABLE permissions FROM tethys_app;
|
||||
// GRANT ALL ON TABLE permissions TO tethys_admin;
|
||||
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE permissions TO tethys_app;
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue