-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more indexes, convert transactionId to bigint, fetch with a timeout
- Loading branch information
Showing
8 changed files
with
111 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
core/src/migrations/Migration20240322153919_index_table.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Migration } from '@mikro-orm/migrations'; | ||
|
||
export class Migration20240322153919_index_table extends Migration { | ||
|
||
async up(): Promise<void> { | ||
this.addSql('CREATE INDEX IF NOT EXISTS "changes_table_index" ON "changes" ("table");'); | ||
} | ||
|
||
async down(): Promise<void> { | ||
this.addSql('drop index "changes_table_index";'); | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
core/src/migrations/Migration20240322173541_index_operation_and_unique.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Migration } from '@mikro-orm/migrations'; | ||
|
||
export class Migration20240322173541_index_operation_and_unique extends Migration { | ||
|
||
async up(): Promise<void> { | ||
this.addSql('alter table "changes" drop constraint "changes_position_operation_table_schema_database_unique";'); | ||
this.addSql('create index "changes_operation_index" on "changes" ("operation");'); | ||
this.addSql('alter table "changes" add constraint "changes_position_table_schema_database_unique" unique ("position", "table", "schema", "database");'); | ||
} | ||
|
||
async down(): Promise<void> { | ||
this.addSql('drop index "changes_operation_index";'); | ||
this.addSql('alter table "changes" drop constraint "changes_position_table_schema_database_unique";'); | ||
this.addSql('alter table "changes" add constraint "changes_position_operation_table_schema_database_unique" unique ("position", "operation", "table", "schema", "database");'); | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
core/src/migrations/Migration20240322174908_return_unique_index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Migration } from '@mikro-orm/migrations'; | ||
|
||
export class Migration20240322174908_return_unique_index extends Migration { | ||
|
||
async up(): Promise<void> { | ||
this.addSql('alter table "changes" drop constraint "changes_position_table_schema_database_unique";'); | ||
this.addSql('alter table "changes" add constraint "changes_position_table_schema_database_operation_unique" unique ("position", "table", "schema", "database", "operation");'); | ||
} | ||
|
||
async down(): Promise<void> { | ||
this.addSql('alter table "changes" drop constraint "changes_position_table_schema_database_operation_unique";'); | ||
this.addSql('alter table "changes" add constraint "changes_position_table_schema_database_unique" unique ("position", "table", "schema", "database");'); | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
core/src/migrations/Migration20240401141659_transaction_id_to_bigint.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Migration } from '@mikro-orm/migrations'; | ||
|
||
export class Migration20240401141659_transaction_id_to_bigint extends Migration { | ||
|
||
async up(): Promise<void> { | ||
this.addSql('alter table "changes" alter column "transaction_id" type bigint using ("transaction_id"::bigint);'); | ||
} | ||
|
||
async down(): Promise<void> { | ||
this.addSql('alter table "changes" alter column "transaction_id" type int using ("transaction_id"::int);'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters