tethys.backend/database/migrations/acl_5_link_accounts_roles.ts
Arno Kaimbacher 4714dfdd94
All checks were successful
CI Pipeline / japa-tests (push) Successful in 46s
- use latest prettier 3.0 with eslint-plugin-prettier: 5.0.0-alpha.2
- npm normal updates
- add all xslt and style asstes in extra folder public/assets2
- linting corrections
- delete local .env.test from git tracking: git rm --cached .env.test
- add .env.test into .gitignore file
- add edit functionality for editing by submitter
- npm updates
-added xslt3 packeage for builfing sef files
- added Language.ts class vor language table
- added version to datasetxml2oai-pmh.xslt
2023-07-17 19:13:30 +02:00

49 lines
1.9 KiB
TypeScript

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
// )