Merge branch 'develop' into adiDev
This commit is contained in:
commit
469a7aa31b
1 changed files with 22 additions and 0 deletions
|
|
@ -0,0 +1,22 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTableProfileempAddRole11718089860221 implements MigrationInterface {
|
||||
name = 'UpdateTableProfileempAddRole11718089860221'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE TABLE \`authSys\` (\`id\` varchar(255) NOT NULL COMMENT 'ไอดีหลักของตาราง', \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`sysName\` varchar(255) NULL COMMENT 'ชื่อระบบ', \`sysDescription\` varchar(255) NULL COMMENT 'รายละเอียด', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`authRole\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`roleName\` varchar(255) NULL COMMENT 'ชื่อบทบาท', \`roleDescription\` varchar(255) NULL COMMENT 'รายละเอียด', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`authRoleAttr\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`attrOwnership\` varchar(255) NULL, \`attrIsCreate\` tinyint NOT NULL DEFAULT 0, \`attrIsList\` tinyint NOT NULL DEFAULT 0, \`attrIsGet\` tinyint NOT NULL DEFAULT 0, \`attrIsUpdate\` tinyint NOT NULL DEFAULT 0, \`attrIsDelete\` tinyint NOT NULL DEFAULT 0, \`attrPrivilege\` varchar(255) NULL, \`authRoleId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง AuthRole', \`authSysId\` varchar(255) NULL COMMENT 'คีย์นอก(FK)ของตาราง AuthSys', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` ADD CONSTRAINT \`FK_b5b59c60792d518f4f025379dba\` FOREIGN KEY (\`authSysId\`) REFERENCES \`authSys\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` ADD CONSTRAINT \`FK_c50907c64fce7ed8f2fb68a3d50\` FOREIGN KEY (\`authRoleId\`) REFERENCES \`authRole\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` DROP FOREIGN KEY \`FK_c50907c64fce7ed8f2fb68a3d50\``);
|
||||
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` DROP FOREIGN KEY \`FK_b5b59c60792d518f4f025379dba\``);
|
||||
await queryRunner.query(`DROP TABLE \`authRoleAttr\``);
|
||||
await queryRunner.query(`DROP TABLE \`authRole\``);
|
||||
await queryRunner.query(`DROP TABLE \`authSys\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue