- 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
52
database/migrations/acl_5_link_accounts_roles.ts
Normal file
52
database/migrations/acl_5_link_accounts_roles.ts
Normal file
|
@ -0,0 +1,52 @@
|
|||
import BaseSchema from '@ioc:Adonis/Lucid/Schema';
|
||||
|
||||
export default class LinkAccountsRoles extends BaseSchema {
|
||||
// protected tableName = Config.get('rolePermission.user_role_table', 'user_roles')
|
||||
protected tableName = 'link_accounts_roles';
|
||||
|
||||
public async up() {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.integer('account_id').index().unsigned().notNullable();
|
||||
table
|
||||
.foreign('account_id', 'link_accounts_roles_account_id_foreign')
|
||||
.references('id')
|
||||
.inTable('accounts')
|
||||
// .inTable(Config.get('rolePermission.user_table', 'users'))
|
||||
.onDelete('CASCADE') // delete this when account is delete
|
||||
.onUpdate('CASCADE');
|
||||
table.integer('role_id').index().unsigned().notNullable();
|
||||
table
|
||||
.foreign('role_id', 'link_accounts_roles_role_id_foreign')
|
||||
.references('id')
|
||||
.inTable('roles')
|
||||
// .inTable(Config.get('rolePermission.role_table', 'roles'))
|
||||
.onDelete('CASCADE') // delete this when account is delete
|
||||
.onUpdate('CASCADE');
|
||||
table.primary(['account_id', 'role_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public async down() {
|
||||
this.schema.dropTable(this.tableName);
|
||||
}
|
||||
}
|
||||
|
||||
// CREATE TABLE IF NOT EXISTS link_accounts_roles
|
||||
// (
|
||||
// account_id integer NOT NULL,
|
||||
// role_id integer NOT NULL,
|
||||
// CONSTRAINT link_accounts_roles_pkey PRIMARY KEY (account_id, role_id),
|
||||
// CONSTRAINT link_accounts_roles_account_id_foreign FOREIGN KEY (account_id)
|
||||
// REFERENCES accounts (id) MATCH SIMPLE
|
||||
// ON UPDATE CASCADE
|
||||
// ON DELETE CASCADE,
|
||||
// CONSTRAINT link_accounts_roles_role_id_foreign FOREIGN KEY (role_id)
|
||||
// REFERENCES roles (id) MATCH SIMPLE
|
||||
// ON UPDATE CASCADE
|
||||
// ON DELETE CASCADE
|
||||
// )
|
||||
// ALTER TABLE IF EXISTS link_accounts_roles
|
||||
// OWNER to tethys_admin;
|
||||
// REVOKE ALL ON TABLE link_accounts_roles FROM tethys_app;
|
||||
// GRANT ALL ON TABLE link_accounts_roles TO tethys_admin;
|
||||
// GRANT DELETE, INSERT, SELECT, UPDATE ON TABLE link_accounts_roles TO tethys_app;
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue