set encryptCompanyId in BossInfo nullable

This commit is contained in:
geekgeekrun
2024-11-20 00:38:35 +08:00
parent 803a3148b2
commit 3f93420717
3 changed files with 41 additions and 2 deletions

View File

@@ -6,7 +6,9 @@ export class BossInfo {
@PrimaryColumn()
encryptBossId: string;
@Column()
@Column({
nullable: true
})
encryptCompanyId: string;
@Column()

View File

@@ -25,6 +25,7 @@ import * as cliHighlight from 'cli-highlight';
import { saveChatStartupRecord, saveJobInfoFromRecommendPage, saveMarkAsNotSuitRecord } from "./handlers";
import { UpdateChatStartupLogTable1729182577167 } from "./migrations/1729182577167-UpdateChatStartupLogTable";
import minimist from 'minimist'
import { UpdateBossInfoTable1732032381304 } from "./migrations/1732032381304-UpdateBossInfoTable";
Boolean(cliHighlight);
@@ -57,7 +58,8 @@ export function initDb(dbFilePath) {
ChatMessageRecord,
],
migrations: [
UpdateChatStartupLogTable1729182577167
UpdateChatStartupLogTable1729182577167,
UpdateBossInfoTable1732032381304
],
migrationsRun: true
});

View File

@@ -0,0 +1,35 @@
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
const viewNames = [
"v_boss_library",
"v_chat_startup_log",
"v_company_library",
"v_job_library",
"v_mark_as_not_suit_log"
];
export class UpdateBossInfoTable1732032381304 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
for (const viewName of viewNames) {
await queryRunner.query(`DROP VIEW IF EXISTS "${viewName}"`);
}
if (await queryRunner.hasTable("boss_info")) {
if (await queryRunner.hasColumn("boss_info", "encryptCompanyId")) {
await queryRunner.changeColumn(
'boss_info',
'encryptCompanyId',
new TableColumn({
name: 'encryptCompanyId',
type: 'varchar',
isNullable: true
})
)
debugger
}
}
}
public async down(queryRunner: QueryRunner): Promise<void> {
}
}