diff --git a/src/controllers/DevelopmentController.ts b/src/controllers/DevelopmentController.ts index 334c9f2..6871cd8 100644 --- a/src/controllers/DevelopmentController.ts +++ b/src/controllers/DevelopmentController.ts @@ -2575,6 +2575,7 @@ export class DevelopmentController extends Controller { isDone: "ASC", isDoneIDP: "ASC", citizenId: "ASC", + type: "DESC", }, }); const _getDevelopment = getDevelopment.map((item) => ({ diff --git a/src/entities/ActualGoal.ts b/src/entities/ActualGoal.ts index 2fe2589..b8fe488 100644 --- a/src/entities/ActualGoal.ts +++ b/src/entities/ActualGoal.ts @@ -71,6 +71,9 @@ export class ActualGoal extends EntityBase { type: string; @Column({ + type: "decimal", + precision: 65, + scale: 0, nullable: true, comment: "จำนวน(คน)", default: null, diff --git a/src/entities/ActualPeople.ts b/src/entities/ActualPeople.ts index 8050810..1215c17 100644 --- a/src/entities/ActualPeople.ts +++ b/src/entities/ActualPeople.ts @@ -12,6 +12,9 @@ export class ActualPeople extends EntityBase { groupTarget: string; @Column({ + type: "decimal", + precision: 65, + scale: 0, nullable: true, comment: "จำนวน(คน)", default: null, diff --git a/src/entities/Development.ts b/src/entities/Development.ts index 94f773b..7775b67 100644 --- a/src/entities/Development.ts +++ b/src/entities/Development.ts @@ -183,8 +183,8 @@ export class Development extends EntityBase { year: number; @Column({ + type: "longtext", comment: "ชื่อโครงการ/กิจกรรม/หลักสูตร", - length: 255, }) projectName: string; @@ -192,7 +192,7 @@ export class Development extends EntityBase { nullable: true, comment: "หลักการและเหตุผล", default: null, - type: "text", + type: "longtext", }) reason: string; @@ -200,7 +200,7 @@ export class Development extends EntityBase { nullable: true, comment: "วัตถุประสงค์", default: null, - type: "text", + type: "longtext", }) objective: string; @@ -254,6 +254,9 @@ export class Development extends EntityBase { isHoldPlanned: boolean; @Column({ + type: "decimal", + precision: 65, + scale: 0, nullable: true, comment: "จำนวน(วัน)(ไป-กลับ)", default: null, @@ -261,6 +264,9 @@ export class Development extends EntityBase { projectDayBackPlanned: number; @Column({ + type: "decimal", + precision: 65, + scale: 0, nullable: true, comment: "จำนวน(วัน)(พักค้าง)", default: null, @@ -268,6 +274,9 @@ export class Development extends EntityBase { projectDayHoldPlanned: number; @Column({ + type: "decimal", + precision: 65, + scale: 0, nullable: true, comment: "จำนวน(คืน)(พักค้าง)", default: null, @@ -287,6 +296,9 @@ export class Development extends EntityBase { isHoldActual: boolean; @Column({ + type: "decimal", + precision: 65, + scale: 0, nullable: true, comment: "จำนวน(วัน)(ไป-กลับ)", default: null, @@ -294,6 +306,9 @@ export class Development extends EntityBase { projectDayBackActual: number; @Column({ + type: "decimal", + precision: 65, + scale: 0, nullable: true, comment: "จำนวน(วัน)(พักค้าง)", default: null, @@ -301,6 +316,9 @@ export class Development extends EntityBase { projectDayHoldActual: number; @Column({ + type: "decimal", + precision: 65, + scale: 0, nullable: true, comment: "จำนวน(คืน)(พักค้าง)", default: null, @@ -308,6 +326,7 @@ export class Development extends EntityBase { projectNigthHoldActual: number; @Column({ + type: "longtext", nullable: true, comment: "รายละเอียดอื่นๆ 70 แผน", default: null, @@ -315,6 +334,7 @@ export class Development extends EntityBase { reasonPlanned70: string; @Column({ + type: "longtext", nullable: true, comment: "รายละเอียดอื่นๆ 20 แผน", default: null, @@ -322,6 +342,7 @@ export class Development extends EntityBase { reasonPlanned20: string; @Column({ + type: "longtext", nullable: true, comment: "รายละเอียดอื่นๆ 10 แผน", default: null, @@ -400,6 +421,9 @@ export class Development extends EntityBase { developmentProjectTechniqueActuals: DevelopmentProjectTechniqueActual[]; @Column({ + type: "decimal", + precision: 65, + scale: 0, nullable: true, comment: "จำนวน(รุ่น)ตามแผน", default: null, @@ -407,6 +431,9 @@ export class Development extends EntityBase { projectModalPlanned: number; @Column({ + type: "decimal", + precision: 65, + scale: 0, nullable: true, comment: "จำนวน(รุ่น)ตามจริง", default: null, @@ -573,6 +600,7 @@ export class Development extends EntityBase { riskManagement: string; @Column({ + type: "longtext", nullable: true, comment: "ประโยชน์ที่คาดว่าจะได้รับ", default: null, @@ -580,6 +608,7 @@ export class Development extends EntityBase { expect: string; @Column({ + type: "longtext", nullable: true, comment: "หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน", default: null, @@ -587,6 +616,7 @@ export class Development extends EntityBase { topicAcademic: string; @Column({ + type: "longtext", nullable: true, comment: "สถานที่ฝึกอบรม ศึกษาดูงาน", default: null, diff --git a/src/entities/DevelopmentEvaluation.ts b/src/entities/DevelopmentEvaluation.ts index 6dff8d6..0574d41 100644 --- a/src/entities/DevelopmentEvaluation.ts +++ b/src/entities/DevelopmentEvaluation.ts @@ -5,6 +5,7 @@ import { Development } from "./Development"; @Entity("developmentEvaluation") export class DevelopmentEvaluation extends EntityBase { @Column({ + type: "longtext", nullable: true, comment: "ตัวชี้วัด", default: null, @@ -12,6 +13,9 @@ export class DevelopmentEvaluation extends EntityBase { indicators: string; @Column({ + type: "decimal", + precision: 65, + scale: 0, nullable: true, comment: "เป้าหมาย", default: null, @@ -26,6 +30,7 @@ export class DevelopmentEvaluation extends EntityBase { metricType: string; @Column({ + type: "longtext", nullable: true, comment: "วิธีการคำนวณ/เครื่องมือ", default: null, @@ -33,6 +38,7 @@ export class DevelopmentEvaluation extends EntityBase { calculation: string; @Column({ + type: "longtext", nullable: true, comment: "ระยะเวลาวัดผล", default: null, diff --git a/src/entities/DevelopmentOther.ts b/src/entities/DevelopmentOther.ts index 98e145a..f127953 100644 --- a/src/entities/DevelopmentOther.ts +++ b/src/entities/DevelopmentOther.ts @@ -5,6 +5,7 @@ import { Development } from "./Development"; @Entity("developmentOther") export class DevelopmentOther extends EntityBase { @Column({ + type: "longtext", nullable: true, comment: "หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน", default: null, @@ -12,6 +13,7 @@ export class DevelopmentOther extends EntityBase { topicAcademic: string; @Column({ + type: "longtext", nullable: true, comment: "สถานที่ฝึกอบรม ศึกษาดูงาน", default: null, diff --git a/src/entities/DevelopmentRisk.ts b/src/entities/DevelopmentRisk.ts index b146cba..ee2d363 100644 --- a/src/entities/DevelopmentRisk.ts +++ b/src/entities/DevelopmentRisk.ts @@ -5,6 +5,7 @@ import { Development } from "./Development"; @Entity("developmentRisk") export class DevelopmentRisk extends EntityBase { @Column({ + type: "longtext", nullable: true, comment: "ประเด็นความเสี่ยง", default: null, @@ -33,6 +34,7 @@ export class DevelopmentRisk extends EntityBase { riskLevel: string; @Column({ + type: "longtext", nullable: true, comment: "เเนวทางการบริหารความเสี่ยง", default: null, diff --git a/src/entities/DevelopmentScholarship.ts b/src/entities/DevelopmentScholarship.ts index 24745ae..f6e34eb 100644 --- a/src/entities/DevelopmentScholarship.ts +++ b/src/entities/DevelopmentScholarship.ts @@ -318,9 +318,9 @@ export class DevelopmentScholarship extends EntityBase { useOfficialTime: string; @Column({ + type: "longtext", nullable: true, comment: "เปลี่ยนแปลงรายละเอียด", - type: "text", default: null, }) changeDetail: string; diff --git a/src/entities/PlannedGoal.ts b/src/entities/PlannedGoal.ts index 4e070fb..5d6d915 100644 --- a/src/entities/PlannedGoal.ts +++ b/src/entities/PlannedGoal.ts @@ -56,6 +56,9 @@ export class PlannedGoal extends EntityBase { type: string; @Column({ + type: "decimal", + precision: 65, + scale: 0, nullable: true, comment: "จำนวน(คน)", default: null, diff --git a/src/entities/PlannedGoalPosition.ts b/src/entities/PlannedGoalPosition.ts index a5df81d..a37f926 100644 --- a/src/entities/PlannedGoalPosition.ts +++ b/src/entities/PlannedGoalPosition.ts @@ -7,6 +7,7 @@ import { PlannedGoal } from "./PlannedGoal"; @Entity("plannedGoalPosition") export class PlannedGoalPosition extends EntityBase { @Column({ + type: "longtext", nullable: true, comment: "ตำแหน่ง", default: null, diff --git a/src/entities/PlannedPeople.ts b/src/entities/PlannedPeople.ts index 8743fd1..38b3c11 100644 --- a/src/entities/PlannedPeople.ts +++ b/src/entities/PlannedPeople.ts @@ -12,6 +12,9 @@ export class PlannedPeople extends EntityBase { groupTarget: string; @Column({ + type: "decimal", + precision: 65, + scale: 0, nullable: true, comment: "จำนวน(คน)", default: null, diff --git a/src/migration/1764651579684-update_datatype_fields.ts b/src/migration/1764651579684-update_datatype_fields.ts new file mode 100644 index 0000000..37587b9 --- /dev/null +++ b/src/migration/1764651579684-update_datatype_fields.ts @@ -0,0 +1,132 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateDatatypeFields1764651579684 implements MigrationInterface { + name = 'UpdateDatatypeFields1764651579684' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`actualPeople\` DROP COLUMN \`amount\``); + await queryRunner.query(`ALTER TABLE \`actualPeople\` ADD \`amount\` decimal NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`plannedPeople\` DROP COLUMN \`amount\``); + await queryRunner.query(`ALTER TABLE \`plannedPeople\` ADD \`amount\` decimal NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`actualGoal\` DROP COLUMN \`amount\``); + await queryRunner.query(`ALTER TABLE \`actualGoal\` ADD \`amount\` decimal NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`plannedGoal\` DROP COLUMN \`amount\``); + await queryRunner.query(`ALTER TABLE \`plannedGoal\` ADD \`amount\` decimal NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`developmentScholarship\` DROP COLUMN \`changeDetail\``); + await queryRunner.query(`ALTER TABLE \`developmentScholarship\` ADD \`changeDetail\` longtext NULL COMMENT 'เปลี่ยนแปลงรายละเอียด'`); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`indicators\``); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`indicators\` longtext NULL COMMENT 'ตัวชี้วัด'`); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`target\``); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`target\` decimal NULL COMMENT 'เป้าหมาย'`); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`calculation\``); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`calculation\` longtext NULL COMMENT 'วิธีการคำนวณ/เครื่องมือ'`); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`measuRement\``); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`measuRement\` longtext NULL COMMENT 'ระยะเวลาวัดผล'`); + await queryRunner.query(`ALTER TABLE \`developmentRisk\` DROP COLUMN \`issues\``); + await queryRunner.query(`ALTER TABLE \`developmentRisk\` ADD \`issues\` longtext NULL COMMENT 'ประเด็นความเสี่ยง'`); + await queryRunner.query(`ALTER TABLE \`developmentRisk\` DROP COLUMN \`riskManagement\``); + await queryRunner.query(`ALTER TABLE \`developmentRisk\` ADD \`riskManagement\` longtext NULL COMMENT 'เเนวทางการบริหารความเสี่ยง'`); + await queryRunner.query(`ALTER TABLE \`developmentOther\` DROP COLUMN \`topicAcademic\``); + await queryRunner.query(`ALTER TABLE \`developmentOther\` ADD \`topicAcademic\` longtext NULL COMMENT 'หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน'`); + await queryRunner.query(`ALTER TABLE \`developmentOther\` DROP COLUMN \`addressAcademic\``); + await queryRunner.query(`ALTER TABLE \`developmentOther\` ADD \`addressAcademic\` longtext NULL COMMENT 'สถานที่ฝึกอบรม ศึกษาดูงาน'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectName\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectName\` longtext NOT NULL COMMENT 'ชื่อโครงการ/กิจกรรม/หลักสูตร'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reason\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`reason\` longtext NULL COMMENT 'หลักการและเหตุผล'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`objective\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`objective\` longtext NULL COMMENT 'วัตถุประสงค์'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayBackPlanned\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayBackPlanned\` decimal NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayHoldPlanned\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayHoldPlanned\` decimal NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectNigthHoldPlanned\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectNigthHoldPlanned\` decimal NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayBackActual\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayBackActual\` decimal NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayHoldActual\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayHoldActual\` decimal NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectNigthHoldActual\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectNigthHoldActual\` decimal NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reasonPlanned70\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`reasonPlanned70\` longtext NULL COMMENT 'รายละเอียดอื่นๆ 70 แผน'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reasonPlanned20\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`reasonPlanned20\` longtext NULL COMMENT 'รายละเอียดอื่นๆ 20 แผน'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reasonPlanned10\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`reasonPlanned10\` longtext NULL COMMENT 'รายละเอียดอื่นๆ 10 แผน'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectModalPlanned\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectModalPlanned\` decimal NULL COMMENT 'จำนวน(รุ่น)ตามแผน'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectModalActual\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectModalActual\` decimal NULL COMMENT 'จำนวน(รุ่น)ตามจริง'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`expect\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`expect\` longtext NULL COMMENT 'ประโยชน์ที่คาดว่าจะได้รับ'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`topicAcademic\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`topicAcademic\` longtext NULL COMMENT 'หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`addressAcademic\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`addressAcademic\` longtext NULL COMMENT 'สถานที่ฝึกอบรม ศึกษาดูงาน'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`addressAcademic\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`addressAcademic\` varchar(255) NULL COMMENT 'สถานที่ฝึกอบรม ศึกษาดูงาน'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`topicAcademic\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`topicAcademic\` varchar(255) NULL COMMENT 'หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`expect\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`expect\` varchar(255) NULL COMMENT 'ประโยชน์ที่คาดว่าจะได้รับ'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectModalActual\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectModalActual\` int NULL COMMENT 'จำนวน(รุ่น)ตามจริง'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectModalPlanned\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectModalPlanned\` int NULL COMMENT 'จำนวน(รุ่น)ตามแผน'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reasonPlanned10\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`reasonPlanned10\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 10 แผน'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reasonPlanned20\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`reasonPlanned20\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 20 แผน'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reasonPlanned70\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`reasonPlanned70\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 70 แผน'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectNigthHoldActual\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectNigthHoldActual\` int NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayHoldActual\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayHoldActual\` int NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayBackActual\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayBackActual\` int NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectNigthHoldPlanned\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectNigthHoldPlanned\` int NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayHoldPlanned\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayHoldPlanned\` int NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayBackPlanned\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayBackPlanned\` int NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`objective\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`objective\` text NULL COMMENT 'วัตถุประสงค์'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reason\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`reason\` text NULL COMMENT 'หลักการและเหตุผล'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectName\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectName\` varchar(255) NOT NULL COMMENT 'ชื่อโครงการ/กิจกรรม/หลักสูตร'`); + await queryRunner.query(`ALTER TABLE \`developmentOther\` DROP COLUMN \`addressAcademic\``); + await queryRunner.query(`ALTER TABLE \`developmentOther\` ADD \`addressAcademic\` varchar(255) NULL COMMENT 'สถานที่ฝึกอบรม ศึกษาดูงาน'`); + await queryRunner.query(`ALTER TABLE \`developmentOther\` DROP COLUMN \`topicAcademic\``); + await queryRunner.query(`ALTER TABLE \`developmentOther\` ADD \`topicAcademic\` varchar(255) NULL COMMENT 'หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน'`); + await queryRunner.query(`ALTER TABLE \`developmentRisk\` DROP COLUMN \`riskManagement\``); + await queryRunner.query(`ALTER TABLE \`developmentRisk\` ADD \`riskManagement\` varchar(255) NULL COMMENT 'เเนวทางการบริหารความเสี่ยง'`); + await queryRunner.query(`ALTER TABLE \`developmentRisk\` DROP COLUMN \`issues\``); + await queryRunner.query(`ALTER TABLE \`developmentRisk\` ADD \`issues\` varchar(255) NULL COMMENT 'ประเด็นความเสี่ยง'`); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`measuRement\``); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`measuRement\` varchar(255) NULL COMMENT 'ระยะเวลาวัดผล'`); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`calculation\``); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`calculation\` varchar(255) NULL COMMENT 'วิธีการคำนวณ/เครื่องมือ'`); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`target\``); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`target\` int NULL COMMENT 'เป้าหมาย'`); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`indicators\``); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`indicators\` varchar(255) NULL COMMENT 'ตัวชี้วัด'`); + await queryRunner.query(`ALTER TABLE \`developmentScholarship\` DROP COLUMN \`changeDetail\``); + await queryRunner.query(`ALTER TABLE \`developmentScholarship\` ADD \`changeDetail\` text NULL COMMENT 'เปลี่ยนแปลงรายละเอียด'`); + await queryRunner.query(`ALTER TABLE \`plannedGoal\` DROP COLUMN \`amount\``); + await queryRunner.query(`ALTER TABLE \`plannedGoal\` ADD \`amount\` int NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`actualGoal\` DROP COLUMN \`amount\``); + await queryRunner.query(`ALTER TABLE \`actualGoal\` ADD \`amount\` int NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`plannedPeople\` DROP COLUMN \`amount\``); + await queryRunner.query(`ALTER TABLE \`plannedPeople\` ADD \`amount\` int NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`actualPeople\` DROP COLUMN \`amount\``); + await queryRunner.query(`ALTER TABLE \`actualPeople\` ADD \`amount\` int NULL COMMENT 'จำนวน(คน)'`); + } + +} diff --git a/src/migration/1764738754427-update_datatype_fields_two.ts b/src/migration/1764738754427-update_datatype_fields_two.ts new file mode 100644 index 0000000..e015d1d --- /dev/null +++ b/src/migration/1764738754427-update_datatype_fields_two.ts @@ -0,0 +1,42 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateDatatypeFieldsTwo1764738754427 implements MigrationInterface { + name = 'UpdateDatatypeFieldsTwo1764738754427' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`actualPeople\` CHANGE \`amount\` \`amount\` decimal(65,0) NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`plannedPeople\` CHANGE \`amount\` \`amount\` decimal(65,0) NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`actualGoal\` CHANGE \`amount\` \`amount\` decimal(65,0) NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` DROP COLUMN \`position\``); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` ADD \`position\` longtext NULL COMMENT 'ตำแหน่ง'`); + await queryRunner.query(`ALTER TABLE \`plannedGoal\` CHANGE \`amount\` \`amount\` decimal(65,0) NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` CHANGE \`target\` \`target\` decimal(65,0) NULL COMMENT 'เป้าหมาย'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayBackPlanned\` \`projectDayBackPlanned\` decimal(65,0) NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayHoldPlanned\` \`projectDayHoldPlanned\` decimal(65,0) NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectNigthHoldPlanned\` \`projectNigthHoldPlanned\` decimal(65,0) NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayBackActual\` \`projectDayBackActual\` decimal(65,0) NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayHoldActual\` \`projectDayHoldActual\` decimal(65,0) NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectNigthHoldActual\` \`projectNigthHoldActual\` decimal(65,0) NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectModalPlanned\` \`projectModalPlanned\` decimal(65,0) NULL COMMENT 'จำนวน(รุ่น)ตามแผน'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectModalActual\` \`projectModalActual\` decimal(65,0) NULL COMMENT 'จำนวน(รุ่น)ตามจริง'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectModalActual\` \`projectModalActual\` decimal(10,0) NULL COMMENT 'จำนวน(รุ่น)ตามจริง'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectModalPlanned\` \`projectModalPlanned\` decimal(10,0) NULL COMMENT 'จำนวน(รุ่น)ตามแผน'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectNigthHoldActual\` \`projectNigthHoldActual\` decimal(10,0) NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayHoldActual\` \`projectDayHoldActual\` decimal(10,0) NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayBackActual\` \`projectDayBackActual\` decimal(10,0) NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectNigthHoldPlanned\` \`projectNigthHoldPlanned\` decimal(10,0) NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayHoldPlanned\` \`projectDayHoldPlanned\` decimal(10,0) NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`); + await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayBackPlanned\` \`projectDayBackPlanned\` decimal(10,0) NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`); + await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` CHANGE \`target\` \`target\` decimal(10,0) NULL COMMENT 'เป้าหมาย'`); + await queryRunner.query(`ALTER TABLE \`plannedGoal\` CHANGE \`amount\` \`amount\` decimal(10,0) NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` DROP COLUMN \`position\``); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` ADD \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง'`); + await queryRunner.query(`ALTER TABLE \`actualGoal\` CHANGE \`amount\` \`amount\` decimal(10,0) NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`plannedPeople\` CHANGE \`amount\` \`amount\` decimal(10,0) NULL COMMENT 'จำนวน(คน)'`); + await queryRunner.query(`ALTER TABLE \`actualPeople\` CHANGE \`amount\` \`amount\` decimal(10,0) NULL COMMENT 'จำนวน(คน)'`); + } + +}