Refactor index creation for chat_flow name across multiple databases to limit indexed length to 255 characters
This commit is contained in:
parent
6e291cf05d
commit
05df462157
|
|
@ -4,7 +4,7 @@ export class AddChatFlowNameIndex1755748356008 implements MigrationInterface {
|
||||||
name = 'AddChatFlowNameIndex1755748356008'
|
name = 'AddChatFlowNameIndex1755748356008'
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
await queryRunner.query(`CREATE INDEX \`IDX_chatflow_name\` ON \`chat_flow\` (\`name\`)`)
|
await queryRunner.query(`CREATE INDEX \`IDX_chatflow_name\` ON \`chat_flow\` (LEFT(\`name\`, 255))`)
|
||||||
}
|
}
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ export class AddChatFlowNameIndex1755748356008 implements MigrationInterface {
|
||||||
name = 'AddChatFlowNameIndex1755748356008'
|
name = 'AddChatFlowNameIndex1755748356008'
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
await queryRunner.query(`CREATE INDEX \`IDX_chatflow_name\` ON \`chat_flow\` (\`name\`)`)
|
await queryRunner.query(`CREATE INDEX \`IDX_chatflow_name\` ON \`chat_flow\` (LEFT(\`name\`, 255))`)
|
||||||
}
|
}
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ export class AddChatFlowNameIndex1755748356008 implements MigrationInterface {
|
||||||
name = 'AddChatFlowNameIndex1755748356008'
|
name = 'AddChatFlowNameIndex1755748356008'
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
await queryRunner.query(`CREATE INDEX "IDX_chatflow_name" ON "chat_flow" ("name")`)
|
await queryRunner.query(`CREATE INDEX "IDX_chatflow_name" ON "chat_flow" (substring("name" from 1 for 255))`)
|
||||||
}
|
}
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ export class AddChatFlowNameIndex1755748356008 implements MigrationInterface {
|
||||||
name = 'AddChatFlowNameIndex1755748356008'
|
name = 'AddChatFlowNameIndex1755748356008'
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
await queryRunner.query(`CREATE INDEX "IDX_chatflow_name" ON "chat_flow" ("name")`)
|
await queryRunner.query(`CREATE INDEX "IDX_chatflow_name" ON "chat_flow" (substr("name", 1, 255))`)
|
||||||
}
|
}
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue