migrate (fix data type) #153
This commit is contained in:
parent
45922287ea
commit
8ef8207cc0
3 changed files with 47 additions and 11 deletions
|
|
@ -256,10 +256,10 @@ export class Registry extends EntityBase {
|
||||||
birthdate: Date;
|
birthdate: Date;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
|
type: "text",
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "วุฒิการศึกษา",
|
comment: "วุฒิการศึกษา",
|
||||||
length: 255,
|
default: null
|
||||||
default: null,
|
|
||||||
})
|
})
|
||||||
degrees: string;
|
degrees: string;
|
||||||
|
|
||||||
|
|
@ -350,18 +350,18 @@ export class Registry extends EntityBase {
|
||||||
Educations: string;
|
Educations: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
|
type: "text",
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "ระดับศึกษา",
|
comment: "ระดับศึกษา",
|
||||||
length: 255,
|
default: null
|
||||||
default: null,
|
|
||||||
})
|
})
|
||||||
educationLevels: string;
|
educationLevels: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
|
type: "text",
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "สาขาวิชา/ทาง",
|
comment: "สาขาวิชา/ทาง",
|
||||||
length: 255,
|
default: null
|
||||||
default: null,
|
|
||||||
})
|
})
|
||||||
fields: string;
|
fields: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -248,9 +248,9 @@ export class RegistryEmployee extends EntityBase {
|
||||||
birthdate: Date;
|
birthdate: Date;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
|
type: "text",
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "วุฒิการศึกษา",
|
comment: "วุฒิการศึกษา",
|
||||||
length: 255,
|
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
degrees: string;
|
degrees: string;
|
||||||
|
|
@ -313,18 +313,18 @@ export class RegistryEmployee extends EntityBase {
|
||||||
Educations: string;
|
Educations: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
|
type: "text",
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "ระดับศึกษา",
|
comment: "ระดับศึกษา",
|
||||||
length: 255,
|
default: null
|
||||||
default: null,
|
|
||||||
})
|
})
|
||||||
educationLevels: string;
|
educationLevels: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
|
type: "text",
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "สาขาวิชา/ทาง",
|
comment: "สาขาวิชา/ทาง",
|
||||||
length: 255,
|
default: null
|
||||||
default: null,
|
|
||||||
})
|
})
|
||||||
fields: string;
|
fields: string;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateDataTypeFieldsRegistryAndRegistryEmpployee1757484721787 implements MigrationInterface {
|
||||||
|
name = 'UpdateDataTypeFieldsRegistryAndRegistryEmpployee1757484721787'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registry\` DROP COLUMN \`degrees\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registry\` ADD \`degrees\` text NULL COMMENT 'วุฒิการศึกษา'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registry\` DROP COLUMN \`educationLevels\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registry\` ADD \`educationLevels\` text NULL COMMENT 'ระดับศึกษา'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registry\` DROP COLUMN \`fields\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registry\` ADD \`fields\` text NULL COMMENT 'สาขาวิชา/ทาง'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registryEmployee\` DROP COLUMN \`degrees\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registryEmployee\` ADD \`degrees\` text NULL COMMENT 'วุฒิการศึกษา'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registryEmployee\` DROP COLUMN \`educationLevels\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registryEmployee\` ADD \`educationLevels\` text NULL COMMENT 'ระดับศึกษา'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registryEmployee\` DROP COLUMN \`fields\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registryEmployee\` ADD \`fields\` text NULL COMMENT 'สาขาวิชา/ทาง'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registryEmployee\` DROP COLUMN \`fields\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registryEmployee\` ADD \`fields\` varchar(255) NULL COMMENT 'สาขาวิชา/ทาง'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registryEmployee\` DROP COLUMN \`educationLevels\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registryEmployee\` ADD \`educationLevels\` varchar(255) NULL COMMENT 'ระดับศึกษา'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registryEmployee\` DROP COLUMN \`degrees\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registryEmployee\` ADD \`degrees\` varchar(255) NULL COMMENT 'วุฒิการศึกษา'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registry\` DROP COLUMN \`fields\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registry\` ADD \`fields\` varchar(255) NULL COMMENT 'สาขาวิชา/ทาง'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registry\` DROP COLUMN \`educationLevels\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registry\` ADD \`educationLevels\` varchar(255) NULL COMMENT 'ระดับศึกษา'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registry\` DROP COLUMN \`degrees\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`registry\` ADD \`degrees\` varchar(255) NULL COMMENT 'วุฒิการศึกษา'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue