migration

This commit is contained in:
Adisak 2025-11-04 15:16:53 +07:00
parent b1a9c77c8c
commit 6cc6bed806
2 changed files with 23 additions and 3 deletions

View file

@ -6,17 +6,17 @@ import { ApiName } from "./ApiName";
@Entity("apiHistory")
export class ApiHistory extends EntityBase {
@Column({
type: 'longtext',
nullable: true,
comment: "header",
length: 255,
default: null,
default: null,
})
headerApi: string;
@Column({
type: 'longtext',
nullable: true,
comment: "token",
length: 255,
default: null,
})
tokenApi: string;

View file

@ -0,0 +1,20 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateSizeHeaderApiAndTokenApiFieldApiHistoryTable1762243747843 implements MigrationInterface {
name = 'UpdateSizeHeaderApiAndTokenApiFieldApiHistoryTable1762243747843'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`apiHistory\` DROP COLUMN \`headerApi\``);
await queryRunner.query(`ALTER TABLE \`apiHistory\` ADD \`headerApi\` longtext NULL COMMENT 'header'`);
await queryRunner.query(`ALTER TABLE \`apiHistory\` DROP COLUMN \`tokenApi\``);
await queryRunner.query(`ALTER TABLE \`apiHistory\` ADD \`tokenApi\` longtext NULL COMMENT 'token'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`apiHistory\` DROP COLUMN \`tokenApi\``);
await queryRunner.query(`ALTER TABLE \`apiHistory\` ADD \`tokenApi\` varchar(255) NULL COMMENT 'token'`);
await queryRunner.query(`ALTER TABLE \`apiHistory\` DROP COLUMN \`headerApi\``);
await queryRunner.query(`ALTER TABLE \`apiHistory\` ADD \`headerApi\` varchar(255) NULL COMMENT 'header'`);
}
}