แก้ไขสิทธิ์

This commit is contained in:
kittapath 2024-09-13 15:34:01 +07:00
parent 4641362b95
commit 0024ed9414
9 changed files with 154 additions and 27 deletions

View file

@ -0,0 +1,18 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateChild1AddIsOfficer1726209768514 implements MigrationInterface {
name = 'UpdateChild1AddIsOfficer1726209768514'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP COLUMN \`isOfficer\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`isOfficer\``);
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT 0`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP COLUMN \`isOfficer\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT '0'`);
}
}

View file

@ -0,0 +1,18 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateChild1AddIsOfficer11726215497371 implements MigrationInterface {
name = 'UpdateChild1AddIsOfficer11726215497371'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`commandSendCC\` (\`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', \`name\` varchar(255) NULL COMMENT 'เพศ', \`commandSendId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง commandSend', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`commandSend\` DROP COLUMN \`sendCC\``);
await queryRunner.query(`ALTER TABLE \`commandSendCC\` ADD CONSTRAINT \`FK_52f7c9e67d813ba4f8c213f436c\` FOREIGN KEY (\`commandSendId\`) REFERENCES \`commandSend\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandSendCC\` DROP FOREIGN KEY \`FK_52f7c9e67d813ba4f8c213f436c\``);
await queryRunner.query(`ALTER TABLE \`commandSend\` ADD \`sendCC\` varchar(20) NULL COMMENT 'ช่องทางการส่งสำเนา'`);
await queryRunner.query(`DROP TABLE \`commandSendCC\``);
}
}