#migrate : add email phone To table issues
All checks were successful
Build & Deploy on Dev / build (push) Successful in 52s

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-02-04 10:43:11 +07:00
parent 30bf5ad9e3
commit 22639e72c6
2 changed files with 33 additions and 0 deletions

View file

@ -30,6 +30,12 @@ export class Issues extends EntityBase {
@Column({ type: "text", nullable: true, comment: "หมายเหตุ" })
remark: string | null;
@Column({ type: "varchar", nullable: true, length: 255, comment: "อีเมลผู้รายงาน" })
email: string | null;
@Column({ type: "varchar", nullable: true, length: 20, comment: "เบอร์โทรผู้รายงาน" })
phone: string | null;
@Column({
type: "enum",
enum: ["NEW", "IN_PROGRESS", "RESOLVED", "CLOSED"],
@ -76,6 +82,8 @@ export interface IssueResponse {
lastUpdatedAt: Date;
createdFullName: string;
lastUpdateFullName: string;
email: string | null;
phone: string | null;
}
export interface CreateIssueRequest {
@ -85,6 +93,8 @@ export interface CreateIssueRequest {
status?: "NEW" | "IN_PROGRESS" | "RESOLVED" | "CLOSED";
menu?: string;
org?: string;
email?: string;
phone?: string;
}
export interface UpdateIssueRequest {

View file

@ -0,0 +1,23 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddEmailPhoneToIssues1738627400000 implements MigrationInterface {
name = 'AddEmailPhoneToIssues1738627400000'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE \`issues\`
ADD \`email\` varchar(255) NULL COMMENT 'อีเมลผู้รายงาน'
`);
await queryRunner.query(`
ALTER TABLE \`issues\`
ADD \`phone\` varchar(20) NULL COMMENT 'เบอร์โทรผู้รายงาน'
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`issues\` DROP COLUMN \`phone\``);
await queryRunner.query(`ALTER TABLE \`issues\` DROP COLUMN \`email\``);
}
}