Skip to content

Fix compatibility issues with db-migration #18831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ import { columnExists } from "./helper/helper";
export class CodeSyncDropDeleted1695733993909 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
if (await columnExists(queryRunner, "d_b_code_sync_resource", "deleted")) {
await queryRunner.query("ALTER TABLE `d_b_code_sync_resource` DROP COLUMN `deleted`, ALGORITHM=INSTANT");
await queryRunner.query("ALTER TABLE `d_b_code_sync_resource` DROP COLUMN `deleted`");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would make sense to use ALGORITHM=INPLACE, LOCK=NONE here, as it's quite a lot of data. Using this is a proven pattern with v5.7 and docs on v8 still show support.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already finish migration, so it's won't affect us, dedicated user don't have large data, so I think it's fine

}
if (await columnExists(queryRunner, "d_b_code_sync_collection", "deleted")) {
await queryRunner.query("ALTER TABLE `d_b_code_sync_collection` DROP COLUMN `deleted`, ALGORITHM=INSTANT");
await queryRunner.query("ALTER TABLE `d_b_code_sync_collection` DROP COLUMN `deleted`");
}
}

public async down(queryRunner: QueryRunner): Promise<void> {
if (!(await columnExists(queryRunner, "d_b_code_sync_collection", "deleted"))) {
await queryRunner.query(
"ALTER TABLE `d_b_code_sync_collection` ADD COLUMN `deleted` tinyint(4) NOT NULL DEFAULT '0', ALGORITHM=INSTANT",
"ALTER TABLE `d_b_code_sync_collection` ADD COLUMN `deleted` tinyint(4) NOT NULL DEFAULT '0'",
);
}
if (!(await columnExists(queryRunner, "d_b_code_sync_resource", "deleted"))) {
await queryRunner.query(
"ALTER TABLE `d_b_code_sync_resource` ADD COLUMN `deleted` tinyint(4) NOT NULL DEFAULT '0', ALGORITHM=INSTANT",
"ALTER TABLE `d_b_code_sync_resource` ADD COLUMN `deleted` tinyint(4) NOT NULL DEFAULT '0'",
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import { columnExists } from "./helper/helper";
export class CostCenterDropDeleted1695735203768 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
if (await columnExists(queryRunner, "d_b_cost_center", "deleted")) {
await queryRunner.query("ALTER TABLE `d_b_cost_center` DROP COLUMN `deleted`, ALGORITHM=INSTANT");
await queryRunner.query("ALTER TABLE `d_b_cost_center` DROP COLUMN `deleted`");
}
}

public async down(queryRunner: QueryRunner): Promise<void> {
if (!(await columnExists(queryRunner, "d_b_cost_center", "deleted"))) {
await queryRunner.query(
"ALTER TABLE `d_b_cost_center` ADD COLUMN `deleted` tinyint(4) NOT NULL DEFAULT '0', ALGORITHM=INSTANT",
"ALTER TABLE `d_b_cost_center` ADD COLUMN `deleted` tinyint(4) NOT NULL DEFAULT '0'",
);
}
}
Expand Down