-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fixed migrations on clean / prod db schema #4591
Conversation
WalkthroughThis pull request introduces several migration classes that modify foreign key and index management in a TypeORM-based application. Key changes include replacing raw SQL queries with utility functions for dropping and adding foreign keys and indexes in the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 11
🧹 Outside diff range and nitpick comments (2)
src/migrations/1727872794564-cleanupRolesIndexes.ts (1)
Line range hint
75-91
: Consider refactoring thedown
method for consistencyWhile the
up
method has been significantly improved, thedown
method remains unchanged and continues to use direct SQL queries. This inconsistency could lead to maintenance issues in the future. Additionally, the comments suggest that these indexes might be "wrong", which raises concerns about the correctness of the rollback process.Consider the following improvements:
- Refactor the
down
method to use utility functions for consistency with theup
method.- Review the correctness of the rollback process, especially given the "wrong index" comments.
- If possible, implement a more robust rollback strategy that ensures data integrity.
Here's a potential refactored version of the
down
method:public async down(queryRunner: QueryRunner): Promise<void> { const tables = ['platform_invitation', 'application', 'invitation']; const indexNames = [ 'FK_b3d3f3c2ce851d1059c4ed26ba2', 'FK_500cee6f635849f50e19c7e2b76', 'FK_339c1fe2a9c5caef5b982303fb0' ]; for (let i = 0; i < tables.length; i++) { await safelyAddIndex(queryRunner, tables[i], indexNames[i], ['roleSetId']); } }Note: This assumes the existence of a
safelyAddIndex
utility function. If it doesn't exist, you may need to create one or use an appropriate alternative.src/migrations/1728033296139-fixIndexesFKsRelations-2.ts (1)
6-391
: Consider using TypeORM's built-in methods for index operationsInstead of executing raw SQL queries, you can utilize TypeORM's methods like
queryRunner.createIndex()
andqueryRunner.dropIndex()
. This approach enhances database portability and aligns with TypeORM best practices.Also applies to: 393-778
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (3)
- src/migrations/1727872794564-cleanupRolesIndexes.ts (1 hunks)
- src/migrations/1728032163157-dropAllIndexesFKsRelations.ts (1 hunks)
- src/migrations/1728033296139-fixIndexesFKsRelations-2.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/migrations/1727872794564-cleanupRolesIndexes.ts (1)
Pattern
src/**/*.{ts,js}
: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs. Ensure that the code adheres to TypeScript's typing system and modern standards.src/migrations/1728032163157-dropAllIndexesFKsRelations.ts (1)
Pattern
src/**/*.{ts,js}
: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs. Ensure that the code adheres to TypeScript's typing system and modern standards.src/migrations/1728033296139-fixIndexesFKsRelations-2.ts (1)
Pattern
src/**/*.{ts,js}
: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs. Ensure that the code adheres to TypeScript's typing system and modern standards.
🪛 Biome
src/migrations/1728032163157-dropAllIndexesFKsRelations.ts
[error] 32-32: Unnecessary continue statement
Unsafe fix: Delete the unnecessary continue statement
(lint/correctness/noUnnecessaryContinue)
[error] 57-57: Unnecessary continue statement
Unsafe fix: Delete the unnecessary continue statement
(lint/correctness/noUnnecessaryContinue)
[error] 75-75: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 95-95: Unnecessary continue statement
Unsafe fix: Delete the unnecessary continue statement
(lint/correctness/noUnnecessaryContinue)
🔇 Additional comments (3)
src/migrations/1727872794564-cleanupRolesIndexes.ts (3)
2-4
: Improved code organization with utility functionsThe introduction of utility functions for safely managing foreign keys and indexes is a positive change. This approach enhances code reusability and maintainability, aligning well with NestJS best practices.
38-71
: Consistent refactoring forapplication
andinvitation
tablesThe changes for the
application
andinvitation
tables follow the same pattern as theplatform_invitation
table, demonstrating a consistent and systematic approach to the refactoring. This consistency improves code maintainability and readability.To ensure the changes maintain the same functionality across all affected tables, please run the following verification script:
Please replace
your_username
andyour_database_name
with the appropriate values for your setup.
12-34
: Improved foreign key and index management forplatform_invitation
The refactoring to use utility functions for managing foreign keys and indexes is a significant improvement. It enhances readability and reduces the risk of SQL-related errors.
To ensure the changes maintain the same functionality, please run the following verification script:
Please replace
your_username
andyour_database_name
with the appropriate values for your setup.✅ Verification successful
Utility functions correctly manage foreign keys and indexes in
platform_invitation
migrationThe migration script appropriately uses utility functions to remove old foreign keys and indexes and add the new foreign key. The review comment regarding missing removed or replaced code is unfounded.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the structure of the platform_invitation table after migration # Test: Check if the foreign key and index are correctly set up echo "Checking platform_invitation table structure:" echo "SELECT CONSTRAINT_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 'platform_invitation' AND REFERENCED_TABLE_NAME IS NOT NULL;" | mysql -u your_username -p your_database_name echo "Checking indexes on platform_invitation table:" echo "SHOW INDEX FROM platform_invitation;" | mysql -u your_username -p your_database_nameLength of output: 708
Script:
#!/bin/bash # Description: Verify removal of old foreign key and index, and addition of new foreign key in the migration script # Search for safelyDropFK call with the old foreign key rg "safelyDropFK\s*\(\s*queryRunner\s*,\s*'platform_invitation'\s*,\s*'FK_b3d3f3c2ce851d1059c4ed26ba2'\s*\)" src/migrations/ # Search for safelyDropIndex call with the old index rg "safelyDropIndex\s*\(\s*queryRunner\s*,\s*'platform_invitation'\s*,\s*'FK_b3d3f3c2ce851d1059c4ed26ba2'\s*\)" src/migrations/ # Search for safelyAddFK call with the new foreign key rg "safelyAddFK\s*\(\s*queryRunner\s*,\s*'platform_invitation'\s*,\s*'FK_562dce4a08bb214f08107b3631e'\s*,\s*'roleSetId'\s*,\s*'role_set'\s*,\s*'id'\s*,\s*'CASCADE'\s*,\s*'NO ACTION'\s*\)" src/migrations/Length of output: 528
Script:
#!/bin/bash # Description: Verify the definitions of utility functions and check for alternative implementations # Search for the definition of safelyDropFK rg "function safelyDropFK" src/ || rg "const safelyDropFK" src/ # Search for the definition of safelyDropIndex rg "function safelyDropIndex" src/ || rg "const safelyDropIndex" src/ # Search for the definition of safelyAddFK rg "function safelyAddFK" src/ || rg "const safelyAddFK" src/ # Additionally, search for any functions related to foreign key and index management rg "safely.*FK" src/ rg "safely.*Index" src/Length of output: 2853
await queryRunner.query( | ||
`DROP INDEX \`IDX_4318f97beabd362a8a09e9d320\` ON \`template\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_45cf273f30c1fa509456b6b0dd\` ON \`template\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_c6e4d1a07781a809ad3b3ee826\` ON \`template\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_eedeae5e63f9a9c3a0161541e9\` ON \`template\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_f09090a77e07377eefb3f731d9\` ON \`template\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_f58c3b144b6e010969e199beef\` ON \`template\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_eb0176ef4b98c143322aa6f809\` ON \`templates_set\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_413ba75964e5a534e4bfa54846\` ON \`space_defaults\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_592a23e68922853bae6ebecd85\` ON \`space_defaults\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_43559aeadc1a5169d17e81b3d4\` ON \`space\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_68fa2c2b00cc1ed77e7c225e8b\` ON \`space\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\` ON \`space\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_8d03fd2c8e8411ec9192c79cd9\` ON \`space\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_980c4643d7d9de1b97bc39f518\` ON \`space\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_9c664d684f987a735678b0ba82\` ON \`space\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_b4250035291aac1329d59224a9\` ON \`space\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_cc0b08eb9679d3daa95153c2af\` ON \`space\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_ea06eb8894469a0f262d929bf0\` ON \`space\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_293f0d3ef60cb0ca0006044ecf\` ON \`ai_persona\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_4504c37764f6962ccbd165a21d\` ON \`virtual_contributor\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_55b8101bdf4f566645e928c26e\` ON \`virtual_contributor\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_a8890dcd65b8c3ee6e160d33f3\` ON \`virtual_contributor\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_e2eaa2213ac4454039cd8abc07\` ON \`virtual_contributor\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_5facd6d188068a5a1c5b6f07fc\` ON \`innovation_pack\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_8af8122897b05315e7eb892525\` ON \`innovation_pack\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_a1441e46c8d36090e1f6477cea\` ON \`innovation_pack\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_833582df0c439ab8c9adc5240d\` ON \`account\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_91a165c1091a6959cc19d52239\` ON \`account\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_950221e932175dc7cf7c006488\` ON \`account\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_36c8905c2c6c59467c60d94fd8\` ON \`innovation_hub\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_b411e4f27d77a96eccdabbf4b4\` ON \`innovation_hub\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_9d520fa5fed56042918e48fc4b\` ON \`ai_server\`` | ||
); | ||
await queryRunner.query( | ||
`DROP INDEX \`IDX_79206feb0038b1c5597668dc4b\` ON \`ai_persona_service\`` | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Refactor repetitive code in the up
method to improve maintainability
The up
method contains numerous repetitive calls to await queryRunner.query(...)
for dropping indexes. Refactoring this by iterating over an array of index definitions can reduce code duplication and enhance readability.
You can modify the up
method as follows:
public async up(queryRunner: QueryRunner): Promise<void> {
+ const indexesToDrop = [
+ 'IDX_eb59b98ee6ef26c993d0d75c83 ON `tagset`',
+ 'IDX_4fbd109f9bb84f58b7a3c60649 ON `visual`',
+ 'IDX_9fb9257b14ec21daf5bc9aa4c8 ON `document`',
+ 'IDX_d9e2dfcccf59233c17cc6bc641 ON `document`',
+ 'IDX_0647707288c243e60091c8d862 ON `storage_aggregator`',
+ 'IDX_f3b4d59c0b805c9c1ecb0070e1 ON `storage_aggregator`',
+ // ... include all index names here
+ ];
+
+ for (const index of indexesToDrop) {
+ await queryRunner.query(`DROP INDEX \`${index}\``);
+ }
-
- await queryRunner.query(
- `DROP INDEX \`IDX_eb59b98ee6ef26c993d0d75c83\` ON \`tagset\``
- );
- await queryRunner.query(
- `DROP INDEX \`IDX_4fbd109f9bb84f58b7a3c60649\` ON \`visual\``
- );
- await queryRunner.query(
- `DROP INDEX \`IDX_9fb9257b14ec21daf5bc9aa4c8\` ON \`document\``
- );
- await queryRunner.query(
- `DROP INDEX \`IDX_d9e2dfcccf59233c17cc6bc641\` ON \`document\``
- );
- await queryRunner.query(
- `DROP INDEX \`IDX_0647707288c243e60091c8d862\` ON \`storage_aggregator\``
- );
- await queryRunner.query(
- `DROP INDEX \`IDX_f3b4d59c0b805c9c1ecb0070e1\` ON \`storage_aggregator\``
- );
- // ... rest of the repetitive calls
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
public async up(queryRunner: QueryRunner): Promise<void> { | |
await queryRunner.query( | |
`DROP INDEX \`IDX_eb59b98ee6ef26c993d0d75c83\` ON \`tagset\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_4fbd109f9bb84f58b7a3c60649\` ON \`visual\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_9fb9257b14ec21daf5bc9aa4c8\` ON \`document\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_d9e2dfcccf59233c17cc6bc641\` ON \`document\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_0647707288c243e60091c8d862\` ON \`storage_aggregator\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_f3b4d59c0b805c9c1ecb0070e1\` ON \`storage_aggregator\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_f2f48b57269987b13b415a0058\` ON \`storage_bucket\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_432056041df0e4337b17ff7b09\` ON \`profile\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_4a1c74fd2a61b32d9d9500e065\` ON \`profile\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_a96475631aba7dce41db03cc8b\` ON \`profile\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_73e8ae665a49366ca7e2866a45\` ON \`reference\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_d1d94dd8e0c417b4188a05ccbc\` ON \`room\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_3f9e9e2798d2a4d84b16ee8477\` ON \`whiteboard\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_d3b86160bb7d704212382b0ca4\` ON \`whiteboard\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_8bc0e1f40be5816d3a593cbf7f\` ON \`callout_framing\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_c9d7c2c4eb8a1d012ddc6605da\` ON \`callout_framing\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_f53e2d266432e58e538a366705\` ON \`callout_framing\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_042b9825d770d6b3009ae206c2\` ON \`post\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_390343b22abec869bf80041933\` ON \`post\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_970844fcd10c2b6df7c1b49eac\` ON \`post\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_07f249ac87502495710a62c5c0\` ON \`link\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_3bfc8c1aaec1395cc148268d3c\` ON \`link\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_5e34f9a356f6254b8da24f8947\` ON \`callout_contribution\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_97fefc97fb254c30577696e1c0\` ON \`callout_contribution\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_bdf2d0eced5c95968a85caaaae\` ON \`callout_contribution\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_dfa86c46f509a61c6510536cd9\` ON \`callout_contribution\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_1e740008a7e1512966e3b08414\` ON \`callout\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_36b0da55acff774d0845aeb55f\` ON \`callout\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_6289dee12effb51320051c6f1f\` ON \`callout\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_62ed316cda7b75735b20307b47\` ON \`callout\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_cf776244b01436d8ca5cc76284\` ON \`callout\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_8ee86afa2808a4ab523b9ee6c5\` ON \`calendar_event\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_9349e137959f3ca5818c2e62b3\` ON \`calendar_event\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_b5069b11030e9608ee4468f850\` ON \`calendar_event\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_6e74d59afda096b68d12a69969\` ON \`calendar\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_56aae15a664b2889a1a11c2cf8\` ON \`timeline\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_5fe58ece01b48496aebc04733d\` ON \`timeline\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_96a8cbe1706f459fd7d883be9b\` ON \`innovation_flow\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_a6e050daa4c7a3ab1e411c3651\` ON \`innovation_flow\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_262ecf3f5d70b82a4833618425\` ON \`collaboration\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_35c6b1de6d4d89dfe8e9c85d77\` ON \`collaboration\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_b7ece56376ac7ca0b9a56c33b3\` ON \`collaboration\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_f67a2d25c945269d602c182fbc\` ON \`collaboration\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_1cc3b275fc2a9d9d9b0ae33b31\` ON \`organization_verification\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_c66eddab0caacb1ef8d46bcafd\` ON \`organization_verification\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_b4cf0f96bf08cf396f68355522\` ON \`preference\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_8e76dcf171c45875c44febb1d8\` ON \`preference_set\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_8ed9d1af584fa62f1ad3405b33\` ON \`agent\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_395aa74996a1f978b4969d114b\` ON \`organization\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_58fd47c4a6ac8df9fe2bcaed87\` ON \`organization\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_5a72d5b37312bac2e0a0115718\` ON \`organization\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_7f1bec8979b57ed7ebd392a2ca\` ON \`organization\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_d2cb77c14644156ec8e865608e\` ON \`organization\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_e0e150e4f11d906b931b46a2d8\` ON \`organization\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_9912e4cfc1e09848a392a65151\` ON \`user_group\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_e8e32f1e59c349b406a4752e54\` ON \`user_group\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_a20c5901817dd09d5906537e08\` ON \`communication\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_eb99e588873c788a68a035478a\` ON \`communication\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_3d60fe4fa40d54bad7d51bb4bd\` ON \`community_guidelines\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_684b272e6f7459439d41d2879e\` ON \`community_guidelines\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_3879db652f2421337691219ace\` ON \`library\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_23d4d78ea8db637df031f86f03\` ON \`license_policy\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_0c6a4d0a6c13a3f5df6ac01509\` ON \`licensing\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_a5dae5a376dd49c7c076893d40\` ON \`licensing\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_2d8a3ca181c3f0346817685d21\` ON \`discussion\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_4555dccdda9ba57d8e3a634cd0\` ON \`discussion\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_5337074c9b818bb63e6f314c80\` ON \`discussion\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_3b0c92945f36d06f37de80285d\` ON \`forum\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_425bbb4b951f7f4629710763fc\` ON \`platform\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_9f621c51dd854634d8766a9cfa\` ON \`platform\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_ca469f5ec53a7719d155d60aca\` ON \`platform\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_dd88d373c64b04e24705d575c9\` ON \`platform\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_f516dd9a46616999c7e9a6adc1\` ON \`platform\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_c0448d2c992a62c9c11bd0f142\` ON \`platform_invitation\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_028322b763dc94242dc9f638f9\` ON \`user\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_09f909622aa177a097256b7cc2\` ON \`user\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_10458c50c10436b6d589b40e5c\` ON \`user\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_9466682df91534dd95e4dbaa61\` ON \`user\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_b61c694cacfab25533bd23d9ad\` ON \`user\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_56f5614fff0028d40370499582\` ON \`application\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_7ec2857c7d8d16432ffca1cb3d\` ON \`application\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_b0c80ccf319a1c7a7af12b3998\` ON \`invitation\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_b132226941570cb650a4023d49\` ON \`invitation\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_00905b142498f63e76d38fb254\` ON \`role_set\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_b038f74c8d4eadb839e78b99ce\` ON \`role_set\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_2e7dd2fa8c829352cfbecb2cc9\` ON \`community\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_3b8f390d76263ef5996869da07\` ON \`community\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_6e7584bfb417bd0f8e8696ab58\` ON \`community\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_7fbe50fa78a37776ad962cb764\` ON \`community\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_a2afa3851ea733de932251b3a1\` ON \`actor\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_bde98d59e8984e7d17034c3b93\` ON \`actor_group\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_658580aea4e1a892227e27db90\` ON \`ecosystem_model\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_5f0dbc3b097ef297bd5f4ddb1a\` ON \`context\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_a03169c3f86480ba3863924f4d\` ON \`context\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_21fdaf6dc88bdd6e8839e29b0b\` ON \`template\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_4318f97beabd362a8a09e9d320\` ON \`template\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_45cf273f30c1fa509456b6b0dd\` ON \`template\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_c6e4d1a07781a809ad3b3ee826\` ON \`template\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_eedeae5e63f9a9c3a0161541e9\` ON \`template\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_f09090a77e07377eefb3f731d9\` ON \`template\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_f58c3b144b6e010969e199beef\` ON \`template\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_eb0176ef4b98c143322aa6f809\` ON \`templates_set\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_413ba75964e5a534e4bfa54846\` ON \`space_defaults\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_592a23e68922853bae6ebecd85\` ON \`space_defaults\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_43559aeadc1a5169d17e81b3d4\` ON \`space\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_68fa2c2b00cc1ed77e7c225e8b\` ON \`space\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\` ON \`space\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_8d03fd2c8e8411ec9192c79cd9\` ON \`space\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_980c4643d7d9de1b97bc39f518\` ON \`space\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_9c664d684f987a735678b0ba82\` ON \`space\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_b4250035291aac1329d59224a9\` ON \`space\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_cc0b08eb9679d3daa95153c2af\` ON \`space\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_ea06eb8894469a0f262d929bf0\` ON \`space\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_293f0d3ef60cb0ca0006044ecf\` ON \`ai_persona\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_4504c37764f6962ccbd165a21d\` ON \`virtual_contributor\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_55b8101bdf4f566645e928c26e\` ON \`virtual_contributor\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_a8890dcd65b8c3ee6e160d33f3\` ON \`virtual_contributor\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_e2eaa2213ac4454039cd8abc07\` ON \`virtual_contributor\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_5facd6d188068a5a1c5b6f07fc\` ON \`innovation_pack\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_8af8122897b05315e7eb892525\` ON \`innovation_pack\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_a1441e46c8d36090e1f6477cea\` ON \`innovation_pack\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_833582df0c439ab8c9adc5240d\` ON \`account\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_91a165c1091a6959cc19d52239\` ON \`account\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_950221e932175dc7cf7c006488\` ON \`account\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_36c8905c2c6c59467c60d94fd8\` ON \`innovation_hub\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_b411e4f27d77a96eccdabbf4b4\` ON \`innovation_hub\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_9d520fa5fed56042918e48fc4b\` ON \`ai_server\`` | |
); | |
await queryRunner.query( | |
`DROP INDEX \`IDX_79206feb0038b1c5597668dc4b\` ON \`ai_persona_service\`` | |
); | |
} | |
public async up(queryRunner: QueryRunner): Promise<void> { | |
const indexesToDrop = [ | |
'IDX_eb59b98ee6ef26c993d0d75c83 ON `tagset`', | |
'IDX_4fbd109f9bb84f58b7a3c60649 ON `visual`', | |
'IDX_9fb9257b14ec21daf5bc9aa4c8 ON `document`', | |
'IDX_d9e2dfcccf59233c17cc6bc641 ON `document`', | |
'IDX_0647707288c243e60091c8d862 ON `storage_aggregator`', | |
'IDX_f3b4d59c0b805c9c1ecb0070e1 ON `storage_aggregator`', | |
'IDX_f2f48b57269987b13b415a0058 ON `storage_bucket`', | |
'IDX_432056041df0e4337b17ff7b09 ON `profile`', | |
'IDX_4a1c74fd2a61b32d9d9500e065 ON `profile`', | |
'IDX_a96475631aba7dce41db03cc8b ON `profile`', | |
'IDX_73e8ae665a49366ca7e2866a45 ON `reference`', | |
'IDX_d1d94dd8e0c417b4188a05ccbc ON `room`', | |
'IDX_3f9e9e2798d2a4d84b16ee8477 ON `whiteboard`', | |
'IDX_d3b86160bb7d704212382b0ca4 ON `whiteboard`', | |
'IDX_8bc0e1f40be5816d3a593cbf7f ON `callout_framing`', | |
'IDX_c9d7c2c4eb8a1d012ddc6605da ON `callout_framing`', | |
'IDX_f53e2d266432e58e538a366705 ON `callout_framing`', | |
'IDX_042b9825d770d6b3009ae206c2 ON `post`', | |
'IDX_390343b22abec869bf80041933 ON `post`', | |
'IDX_970844fcd10c2b6df7c1b49eac ON `post`', | |
'IDX_07f249ac87502495710a62c5c0 ON `link`', | |
'IDX_3bfc8c1aaec1395cc148268d3c ON `link`', | |
'IDX_5e34f9a356f6254b8da24f8947 ON `callout_contribution`', | |
'IDX_97fefc97fb254c30577696e1c0 ON `callout_contribution`', | |
'IDX_bdf2d0eced5c95968a85caaaae ON `callout_contribution`', | |
'IDX_dfa86c46f509a61c6510536cd9 ON `callout_contribution`', | |
'IDX_1e740008a7e1512966e3b08414 ON `callout`', | |
'IDX_36b0da55acff774d0845aeb55f ON `callout`', | |
'IDX_6289dee12effb51320051c6f1f ON `callout`', | |
'IDX_62ed316cda7b75735b20307b47 ON `callout`', | |
'IDX_cf776244b01436d8ca5cc76284 ON `callout`', | |
'IDX_8ee86afa2808a4ab523b9ee6c5 ON `calendar_event`', | |
'IDX_9349e137959f3ca5818c2e62b3 ON `calendar_event`', | |
'IDX_b5069b11030e9608ee4468f850 ON `calendar_event`', | |
'IDX_6e74d59afda096b68d12a69969 ON `calendar`', | |
'IDX_56aae15a664b2889a1a11c2cf8 ON `timeline`', | |
'IDX_5fe58ece01b48496aebc04733d ON `timeline`', | |
'IDX_96a8cbe1706f459fd7d883be9b ON `innovation_flow`', | |
'IDX_a6e050daa4c7a3ab1e411c3651 ON `innovation_flow`', | |
'IDX_262ecf3f5d70b82a4833618425 ON `collaboration`', | |
'IDX_35c6b1de6d4d89dfe8e9c85d77 ON `collaboration`', | |
'IDX_b7ece56376ac7ca0b9a56c33b3 ON `collaboration`', | |
'IDX_f67a2d25c945269d602c182fbc ON `collaboration`', | |
'IDX_1cc3b275fc2a9d9d9b0ae33b31 ON `organization_verification`', | |
'IDX_c66eddab0caacb1ef8d46bcafd ON `organization_verification`', | |
'IDX_b4cf0f96bf08cf396f68355522 ON `preference`', | |
'IDX_8e76dcf171c45875c44febb1d8 ON `preference_set`', | |
'IDX_8ed9d1af584fa62f1ad3405b33 ON `agent`', | |
'IDX_395aa74996a1f978b4969d114b ON `organization`', | |
'IDX_58fd47c4a6ac8df9fe2bcaed87 ON `organization`', | |
'IDX_5a72d5b37312bac2e0a0115718 ON `organization`', | |
'IDX_7f1bec8979b57ed7ebd392a2ca ON `organization`', | |
'IDX_d2cb77c14644156ec8e865608e ON `organization`', | |
'IDX_e0e150e4f11d906b931b46a2d8 ON `organization`', | |
'IDX_9912e4cfc1e09848a392a65151 ON `user_group`', | |
'IDX_e8e32f1e59c349b406a4752e54 ON `user_group`', | |
'IDX_a20c5901817dd09d5906537e08 ON `communication`', | |
'IDX_eb99e588873c788a68a035478a ON `communication`', | |
'IDX_3d60fe4fa40d54bad7d51bb4bd ON `community_guidelines`', | |
'IDX_684b272e6f7459439d41d2879e ON `community_guidelines`', | |
'IDX_3879db652f2421337691219ace ON `library`', | |
'IDX_23d4d78ea8db637df031f86f03 ON `license_policy`', | |
'IDX_0c6a4d0a6c13a3f5df6ac01509 ON `licensing`', | |
'IDX_a5dae5a376dd49c7c076893d40 ON `licensing`', | |
'IDX_2d8a3ca181c3f0346817685d21 ON `discussion`', | |
'IDX_4555dccdda9ba57d8e3a634cd0 ON `discussion`', | |
'IDX_5337074c9b818bb63e6f314c80 ON `discussion`', | |
'IDX_3b0c92945f36d06f37de80285d ON `forum`', | |
'IDX_425bbb4b951f7f4629710763fc ON `platform`', | |
'IDX_9f621c51dd854634d8766a9cfa ON `platform`', | |
'IDX_ca469f5ec53a7719d155d60aca ON `platform`', | |
'IDX_dd88d373c64b04e24705d575c9 ON `platform`', | |
'IDX_f516dd9a46616999c7e9a6adc1 ON `platform`', | |
'IDX_c0448d2c992a62c9c11bd0f142 ON `platform_invitation`', | |
'IDX_028322b763dc94242dc9f638f9 ON `user`', | |
'IDX_09f909622aa177a097256b7cc2 ON `user`', | |
'IDX_10458c50c10436b6d589b40e5c ON `user`', | |
'IDX_9466682df91534dd95e4dbaa61 ON `user`', | |
'IDX_b61c694cacfab25533bd23d9ad ON `user`', | |
'IDX_56f5614fff0028d40370499582 ON `application`', | |
'IDX_7ec2857c7d8d16432ffca1cb3d ON `application`', | |
'IDX_b0c80ccf319a1c7a7af12b3998 ON `invitation`', | |
'IDX_b132226941570cb650a4023d49 ON `invitation`', | |
'IDX_00905b142498f63e76d38fb254 ON `role_set`', | |
'IDX_b038f74c8d4eadb839e78b99ce ON `role_set`', | |
'IDX_2e7dd2fa8c829352cfbecb2cc9 ON `community`', | |
'IDX_3b8f390d76263ef5996869da07 ON `community`', | |
'IDX_6e7584bfb417bd0f8e8696ab58 ON `community`', | |
'IDX_7fbe50fa78a37776ad962cb764 ON `community`', | |
'IDX_a2afa3851ea733de932251b3a1 ON `actor`', | |
'IDX_bde98d59e8984e7d17034c3b93 ON `actor_group`', | |
'IDX_658580aea4e1a892227e27db90 ON `ecosystem_model`', | |
'IDX_5f0dbc3b097ef297bd5f4ddb1a ON `context`', | |
'IDX_a03169c3f86480ba3863924f4d ON `context`', | |
'IDX_21fdaf6dc88bdd6e8839e29b0b ON `template`', | |
'IDX_4318f97beabd362a8a09e9d320 ON `template`', | |
'IDX_45cf273f30c1fa509456b6b0dd ON `template`', | |
'IDX_c6e4d1a07781a809ad3b3ee826 ON `template`', | |
'IDX_eedeae5e63f9a9c3a0161541e9 ON `template`', | |
'IDX_f09090a77e07377eefb3f731d9 ON `template`', | |
'IDX_f58c3b144b6e010969e199beef ON `template`', | |
'IDX_eb0176ef4b98c143322aa6f809 ON `templates_set`', | |
'IDX_413ba75964e5a534e4bfa54846 ON `space_defaults`', | |
'IDX_592a23e68922853bae6ebecd85 ON `space_defaults`', | |
'IDX_43559aeadc1a5169d17e81b3d4 ON `space`', | |
'IDX_68fa2c2b00cc1ed77e7c225e8b ON `space`', | |
'IDX_6b1efee39d076d9f7ecb8fef4c ON `space`', | |
'IDX_8d03fd2c8e8411ec9192c79cd9 ON `space`', | |
'IDX_980c4643d7d9de1b97bc39f518 ON `space`', | |
'IDX_9c664d684f987a735678b0ba82 ON `space`', | |
'IDX_b4250035291aac1329d59224a9 ON `space`', | |
'IDX_cc0b08eb9679d3daa95153c2af ON `space`', | |
'IDX_ea06eb8894469a0f262d929bf0 ON `space`', | |
'IDX_293f0d3ef60cb0ca0006044ecf ON `ai_persona`', | |
'IDX_4504c37764f6962ccbd165a21d ON `virtual_contributor`', | |
'IDX_55b8101bdf4f566645e928c26e ON `virtual_contributor`', | |
'IDX_a8890dcd65b8c3ee6e160d33f3 ON `virtual_contributor`', | |
'IDX_e2eaa2213ac4454039cd8abc07 ON `virtual_contributor`', | |
'IDX_5facd6d188068a5a1c5b6f07fc ON `innovation_pack`', | |
'IDX_8af8122897b05315e7eb892525 ON `innovation_pack`', | |
'IDX_a1441e46c8d36090e1f6477cea ON `innovation_pack`', | |
'IDX_833582df0c439ab8c9adc5240d ON `account`', | |
'IDX_91a165c1091a6959cc19d52239 ON `account`', | |
'IDX_950221e932175dc7cf7c006488 ON `account`', | |
'IDX_36c8905c2c6c59467c60d94fd8 ON `innovation_hub`', | |
'IDX_b411e4f27d77a96eccdabbf4b4 ON `innovation_hub`', | |
'IDX_9d520fa5fed56042918e48fc4b ON `ai_server`', | |
'IDX_79206feb0038b1c5597668dc4b ON `ai_persona_service`', | |
]; | |
for (const index of indexesToDrop) { | |
await queryRunner.query(`DROP INDEX \`${index}\``); | |
} | |
} |
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_9349e137959f3ca5818c2e62b3\` ON \`calendar_event\` (\`profileId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_8ee86afa2808a4ab523b9ee6c5\` ON \`calendar_event\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_cf776244b01436d8ca5cc76284\` ON \`callout\` (\`framingId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_62ed316cda7b75735b20307b47\` ON \`callout\` (\`commentsId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_6289dee12effb51320051c6f1f\` ON \`callout\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_36b0da55acff774d0845aeb55f\` ON \`callout\` (\`contributionDefaultsId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_1e740008a7e1512966e3b08414\` ON \`callout\` (\`contributionPolicyId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_dfa86c46f509a61c6510536cd9\` ON \`callout_contribution\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_bdf2d0eced5c95968a85caaaae\` ON \`callout_contribution\` (\`linkId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_97fefc97fb254c30577696e1c0\` ON \`callout_contribution\` (\`postId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_5e34f9a356f6254b8da24f8947\` ON \`callout_contribution\` (\`whiteboardId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_3bfc8c1aaec1395cc148268d3c\` ON \`link\` (\`profileId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_07f249ac87502495710a62c5c0\` ON \`link\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_970844fcd10c2b6df7c1b49eac\` ON \`post\` (\`profileId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_390343b22abec869bf80041933\` ON \`post\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_042b9825d770d6b3009ae206c2\` ON \`post\` (\`commentsId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_f53e2d266432e58e538a366705\` ON \`callout_framing\` (\`profileId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_c9d7c2c4eb8a1d012ddc6605da\` ON \`callout_framing\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_8bc0e1f40be5816d3a593cbf7f\` ON \`callout_framing\` (\`whiteboardId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_d3b86160bb7d704212382b0ca4\` ON \`whiteboard\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_3f9e9e2798d2a4d84b16ee8477\` ON \`whiteboard\` (\`profileId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_d1d94dd8e0c417b4188a05ccbc\` ON \`room\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_73e8ae665a49366ca7e2866a45\` ON \`reference\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_a96475631aba7dce41db03cc8b\` ON \`profile\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_4a1c74fd2a61b32d9d9500e065\` ON \`profile\` (\`storageBucketId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_432056041df0e4337b17ff7b09\` ON \`profile\` (\`locationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_f2f48b57269987b13b415a0058\` ON \`storage_bucket\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_f3b4d59c0b805c9c1ecb0070e1\` ON \`storage_aggregator\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_0647707288c243e60091c8d862\` ON \`storage_aggregator\` (\`directStorageId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_d9e2dfcccf59233c17cc6bc641\` ON \`document\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_9fb9257b14ec21daf5bc9aa4c8\` ON \`document\` (\`tagsetId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_4fbd109f9bb84f58b7a3c60649\` ON \`visual\` (\`authorizationId\`)` | ||
); | ||
await queryRunner.query( | ||
`CREATE UNIQUE INDEX \`IDX_eb59b98ee6ef26c993d0d75c83\` ON \`tagset\` (\`authorizationId\`)` | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Refactor repetitive code in the down
method to improve maintainability
Similar to the up
method, the down
method has many repetitive calls for creating indexes. Refactoring this by iterating over an array of index creation queries can enhance readability and reduce code duplication.
Here's how you can modify the down
method:
public async down(queryRunner: QueryRunner): Promise<void> {
+ const indexesToCreate = [
+ 'CREATE UNIQUE INDEX `IDX_79206feb0038b1c5597668dc4b` ON `ai_persona_service` (`authorizationId`)',
+ 'CREATE UNIQUE INDEX `IDX_9d520fa5fed56042918e48fc4b` ON `ai_server` (`authorizationId`)',
+ 'CREATE UNIQUE INDEX `IDX_b411e4f27d77a96eccdabbf4b4` ON `innovation_hub` (`authorizationId`)',
+ 'CREATE UNIQUE INDEX `IDX_36c8905c2c6c59467c60d94fd8` ON `innovation_hub` (`profileId`)',
+ // ... include all index creation queries here
+ ];
+
+ for (const query of indexesToCreate) {
+ await queryRunner.query(query);
+ }
-
- await queryRunner.query(
- `CREATE UNIQUE INDEX \`IDX_79206feb0038b1c5597668dc4b\` ON \`ai_persona_service\` (\`authorizationId\`)`
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX \`IDX_9d520fa5fed56042918e48fc4b\` ON \`ai_server\` (\`authorizationId\`)`
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX \`IDX_b411e4f27d77a96eccdabbf4b4\` ON \`innovation_hub\` (\`authorizationId\`)`
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX \`IDX_36c8905c2c6c59467c60d94fd8\` ON \`innovation_hub\` (\`profileId\`)`
- );
- // ... rest of the repetitive calls
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
public async down(queryRunner: QueryRunner): Promise<void> { | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_79206feb0038b1c5597668dc4b\` ON \`ai_persona_service\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_9d520fa5fed56042918e48fc4b\` ON \`ai_server\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_b411e4f27d77a96eccdabbf4b4\` ON \`innovation_hub\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_36c8905c2c6c59467c60d94fd8\` ON \`innovation_hub\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_950221e932175dc7cf7c006488\` ON \`account\` (\`storageAggregatorId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_91a165c1091a6959cc19d52239\` ON \`account\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_833582df0c439ab8c9adc5240d\` ON \`account\` (\`agentId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_a1441e46c8d36090e1f6477cea\` ON \`innovation_pack\` (\`templatesSetId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_8af8122897b05315e7eb892525\` ON \`innovation_pack\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_5facd6d188068a5a1c5b6f07fc\` ON \`innovation_pack\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_e2eaa2213ac4454039cd8abc07\` ON \`virtual_contributor\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_a8890dcd65b8c3ee6e160d33f3\` ON \`virtual_contributor\` (\`agentId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_55b8101bdf4f566645e928c26e\` ON \`virtual_contributor\` (\`aiPersonaId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_4504c37764f6962ccbd165a21d\` ON \`virtual_contributor\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_293f0d3ef60cb0ca0006044ecf\` ON \`ai_persona\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_ea06eb8894469a0f262d929bf0\` ON \`space\` (\`collaborationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_cc0b08eb9679d3daa95153c2af\` ON \`space\` (\`contextId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_b4250035291aac1329d59224a9\` ON \`space\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_9c664d684f987a735678b0ba82\` ON \`space\` (\`agentId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_980c4643d7d9de1b97bc39f518\` ON \`space\` (\`storageAggregatorId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_8d03fd2c8e8411ec9192c79cd9\` ON \`space\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\` ON \`space\` (\`defaultsId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_68fa2c2b00cc1ed77e7c225e8b\` ON \`space\` (\`communityId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_43559aeadc1a5169d17e81b3d4\` ON \`space\` (\`libraryId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_592a23e68922853bae6ebecd85\` ON \`space_defaults\` (\`innovationFlowTemplateId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_413ba75964e5a534e4bfa54846\` ON \`space_defaults\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_eb0176ef4b98c143322aa6f809\` ON \`templates_set\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_f58c3b144b6e010969e199beef\` ON \`template\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_f09090a77e07377eefb3f731d9\` ON \`template\` (\`whiteboardId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_eedeae5e63f9a9c3a0161541e9\` ON \`template\` (\`communityGuidelinesId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_c6e4d1a07781a809ad3b3ee826\` ON \`template\` (\`calloutId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_45cf273f30c1fa509456b6b0dd\` ON \`template\` (\`innovationFlowId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_4318f97beabd362a8a09e9d320\` ON \`template\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_21fdaf6dc88bdd6e8839e29b0b\` ON \`template\` (\`collaborationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_a03169c3f86480ba3863924f4d\` ON \`context\` (\`ecosystemModelId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_5f0dbc3b097ef297bd5f4ddb1a\` ON \`context\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_658580aea4e1a892227e27db90\` ON \`ecosystem_model\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_bde98d59e8984e7d17034c3b93\` ON \`actor_group\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_a2afa3851ea733de932251b3a1\` ON \`actor\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_7fbe50fa78a37776ad962cb764\` ON \`community\` (\`communicationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_6e7584bfb417bd0f8e8696ab58\` ON \`community\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_3b8f390d76263ef5996869da07\` ON \`community\` (\`roleSetId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_2e7dd2fa8c829352cfbecb2cc9\` ON \`community\` (\`guidelinesId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_b038f74c8d4eadb839e78b99ce\` ON \`role_set\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_00905b142498f63e76d38fb254\` ON \`role_set\` (\`applicationFormId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_b132226941570cb650a4023d49\` ON \`invitation\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_b0c80ccf319a1c7a7af12b3998\` ON \`invitation\` (\`lifecycleId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_7ec2857c7d8d16432ffca1cb3d\` ON \`application\` (\`lifecycleId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_56f5614fff0028d40370499582\` ON \`application\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_b61c694cacfab25533bd23d9ad\` ON \`user\` (\`agentId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_9466682df91534dd95e4dbaa61\` ON \`user\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_10458c50c10436b6d589b40e5c\` ON \`user\` (\`storageAggregatorId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_09f909622aa177a097256b7cc2\` ON \`user\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_028322b763dc94242dc9f638f9\` ON \`user\` (\`preferenceSetId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_c0448d2c992a62c9c11bd0f142\` ON \`platform_invitation\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_f516dd9a46616999c7e9a6adc1\` ON \`platform\` (\`storageAggregatorId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_dd88d373c64b04e24705d575c9\` ON \`platform\` (\`forumId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_ca469f5ec53a7719d155d60aca\` ON \`platform\` (\`libraryId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_9f621c51dd854634d8766a9cfa\` ON \`platform\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_425bbb4b951f7f4629710763fc\` ON \`platform\` (\`licensingId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_3b0c92945f36d06f37de80285d\` ON \`forum\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_5337074c9b818bb63e6f314c80\` ON \`discussion\` (\`commentsId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_4555dccdda9ba57d8e3a634cd0\` ON \`discussion\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_2d8a3ca181c3f0346817685d21\` ON \`discussion\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_a5dae5a376dd49c7c076893d40\` ON \`licensing\` (\`licensePolicyId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_0c6a4d0a6c13a3f5df6ac01509\` ON \`licensing\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_23d4d78ea8db637df031f86f03\` ON \`license_policy\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_3879db652f2421337691219ace\` ON \`library\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_684b272e6f7459439d41d2879e\` ON \`community_guidelines\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_3d60fe4fa40d54bad7d51bb4bd\` ON \`community_guidelines\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_eb99e588873c788a68a035478a\` ON \`communication\` (\`updatesId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_a20c5901817dd09d5906537e08\` ON \`communication\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_e8e32f1e59c349b406a4752e54\` ON \`user_group\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_9912e4cfc1e09848a392a65151\` ON \`user_group\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_e0e150e4f11d906b931b46a2d8\` ON \`organization\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_d2cb77c14644156ec8e865608e\` ON \`organization\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_7f1bec8979b57ed7ebd392a2ca\` ON \`organization\` (\`agentId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_5a72d5b37312bac2e0a0115718\` ON \`organization\` (\`verificationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_58fd47c4a6ac8df9fe2bcaed87\` ON \`organization\` (\`preferenceSetId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_395aa74996a1f978b4969d114b\` ON \`organization\` (\`storageAggregatorId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_8ed9d1af584fa62f1ad3405b33\` ON \`agent\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_8e76dcf171c45875c44febb1d8\` ON \`preference_set\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_b4cf0f96bf08cf396f68355522\` ON \`preference\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_c66eddab0caacb1ef8d46bcafd\` ON \`organization_verification\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_1cc3b275fc2a9d9d9b0ae33b31\` ON \`organization_verification\` (\`lifecycleId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_f67a2d25c945269d602c182fbc\` ON \`collaboration\` (\`timelineId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_b7ece56376ac7ca0b9a56c33b3\` ON \`collaboration\` (\`tagsetTemplateSetId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_35c6b1de6d4d89dfe8e9c85d77\` ON \`collaboration\` (\`innovationFlowId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_262ecf3f5d70b82a4833618425\` ON \`collaboration\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_a6e050daa4c7a3ab1e411c3651\` ON \`innovation_flow\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_96a8cbe1706f459fd7d883be9b\` ON \`innovation_flow\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_5fe58ece01b48496aebc04733d\` ON \`timeline\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_56aae15a664b2889a1a11c2cf8\` ON \`timeline\` (\`calendarId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_6e74d59afda096b68d12a69969\` ON \`calendar\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_b5069b11030e9608ee4468f850\` ON \`calendar_event\` (\`commentsId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_9349e137959f3ca5818c2e62b3\` ON \`calendar_event\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_8ee86afa2808a4ab523b9ee6c5\` ON \`calendar_event\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_cf776244b01436d8ca5cc76284\` ON \`callout\` (\`framingId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_62ed316cda7b75735b20307b47\` ON \`callout\` (\`commentsId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_6289dee12effb51320051c6f1f\` ON \`callout\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_36b0da55acff774d0845aeb55f\` ON \`callout\` (\`contributionDefaultsId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_1e740008a7e1512966e3b08414\` ON \`callout\` (\`contributionPolicyId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_dfa86c46f509a61c6510536cd9\` ON \`callout_contribution\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_bdf2d0eced5c95968a85caaaae\` ON \`callout_contribution\` (\`linkId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_97fefc97fb254c30577696e1c0\` ON \`callout_contribution\` (\`postId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_5e34f9a356f6254b8da24f8947\` ON \`callout_contribution\` (\`whiteboardId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_3bfc8c1aaec1395cc148268d3c\` ON \`link\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_07f249ac87502495710a62c5c0\` ON \`link\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_970844fcd10c2b6df7c1b49eac\` ON \`post\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_390343b22abec869bf80041933\` ON \`post\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_042b9825d770d6b3009ae206c2\` ON \`post\` (\`commentsId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_f53e2d266432e58e538a366705\` ON \`callout_framing\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_c9d7c2c4eb8a1d012ddc6605da\` ON \`callout_framing\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_8bc0e1f40be5816d3a593cbf7f\` ON \`callout_framing\` (\`whiteboardId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_d3b86160bb7d704212382b0ca4\` ON \`whiteboard\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_3f9e9e2798d2a4d84b16ee8477\` ON \`whiteboard\` (\`profileId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_d1d94dd8e0c417b4188a05ccbc\` ON \`room\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_73e8ae665a49366ca7e2866a45\` ON \`reference\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_a96475631aba7dce41db03cc8b\` ON \`profile\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_4a1c74fd2a61b32d9d9500e065\` ON \`profile\` (\`storageBucketId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_432056041df0e4337b17ff7b09\` ON \`profile\` (\`locationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_f2f48b57269987b13b415a0058\` ON \`storage_bucket\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_f3b4d59c0b805c9c1ecb0070e1\` ON \`storage_aggregator\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_0647707288c243e60091c8d862\` ON \`storage_aggregator\` (\`directStorageId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_d9e2dfcccf59233c17cc6bc641\` ON \`document\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_9fb9257b14ec21daf5bc9aa4c8\` ON \`document\` (\`tagsetId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_4fbd109f9bb84f58b7a3c60649\` ON \`visual\` (\`authorizationId\`)` | |
); | |
await queryRunner.query( | |
`CREATE UNIQUE INDEX \`IDX_eb59b98ee6ef26c993d0d75c83\` ON \`tagset\` (\`authorizationId\`)` | |
); | |
} | |
public async down(queryRunner: QueryRunner): Promise<void> { | |
const indexesToCreate = [ | |
'CREATE UNIQUE INDEX `IDX_79206feb0038b1c5597668dc4b` ON `ai_persona_service` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_9d520fa5fed56042918e48fc4b` ON `ai_server` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_b411e4f27d77a96eccdabbf4b4` ON `innovation_hub` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_36c8905c2c6c59467c60d94fd8` ON `innovation_hub` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_950221e932175dc7cf7c006488` ON `account` (`storageAggregatorId`)', | |
'CREATE UNIQUE INDEX `IDX_91a165c1091a6959cc19d52239` ON `account` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_833582df0c439ab8c9adc5240d` ON `account` (`agentId`)', | |
'CREATE UNIQUE INDEX `IDX_a1441e46c8d36090e1f6477cea` ON `innovation_pack` (`templatesSetId`)', | |
'CREATE UNIQUE INDEX `IDX_8af8122897b05315e7eb892525` ON `innovation_pack` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_5facd6d188068a5a1c5b6f07fc` ON `innovation_pack` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_e2eaa2213ac4454039cd8abc07` ON `virtual_contributor` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_a8890dcd65b8c3ee6e160d33f3` ON `virtual_contributor` (`agentId`)', | |
'CREATE UNIQUE INDEX `IDX_55b8101bdf4f566645e928c26e` ON `virtual_contributor` (`aiPersonaId`)', | |
'CREATE UNIQUE INDEX `IDX_4504c37764f6962ccbd165a21d` ON `virtual_contributor` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_293f0d3ef60cb0ca0006044ecf` ON `ai_persona` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_ea06eb8894469a0f262d929bf0` ON `space` (`collaborationId`)', | |
'CREATE UNIQUE INDEX `IDX_cc0b08eb9679d3daa95153c2af` ON `space` (`contextId`)', | |
'CREATE UNIQUE INDEX `IDX_b4250035291aac1329d59224a9` ON `space` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_9c664d684f987a735678b0ba82` ON `space` (`agentId`)', | |
'CREATE UNIQUE INDEX `IDX_980c4643d7d9de1b97bc39f518` ON `space` (`storageAggregatorId`)', | |
'CREATE UNIQUE INDEX `IDX_8d03fd2c8e8411ec9192c79cd9` ON `space` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_6b1efee39d076d9f7ecb8fef4c` ON `space` (`defaultsId`)', | |
'CREATE UNIQUE INDEX `IDX_68fa2c2b00cc1ed77e7c225e8b` ON `space` (`communityId`)', | |
'CREATE UNIQUE INDEX `IDX_43559aeadc1a5169d17e81b3d4` ON `space` (`libraryId`)', | |
'CREATE UNIQUE INDEX `IDX_592a23e68922853bae6ebecd85` ON `space_defaults` (`innovationFlowTemplateId`)', | |
'CREATE UNIQUE INDEX `IDX_413ba75964e5a534e4bfa54846` ON `space_defaults` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_eb0176ef4b98c143322aa6f809` ON `templates_set` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_f58c3b144b6e010969e199beef` ON `template` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_f09090a77e07377eefb3f731d9` ON `template` (`whiteboardId`)', | |
'CREATE UNIQUE INDEX `IDX_eedeae5e63f9a9c3a0161541e9` ON `template` (`communityGuidelinesId`)', | |
'CREATE UNIQUE INDEX `IDX_c6e4d1a07781a809ad3b3ee826` ON `template` (`calloutId`)', | |
'CREATE UNIQUE INDEX `IDX_45cf273f30c1fa509456b6b0dd` ON `template` (`innovationFlowId`)', | |
'CREATE UNIQUE INDEX `IDX_4318f97beabd362a8a09e9d320` ON `template` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_21fdaf6dc88bdd6e8839e29b0b` ON `template` (`collaborationId`)', | |
'CREATE UNIQUE INDEX `IDX_a03169c3f86480ba3863924f4d` ON `context` (`ecosystemModelId`)', | |
'CREATE UNIQUE INDEX `IDX_5f0dbc3b097ef297bd5f4ddb1a` ON `context` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_658580aea4e1a892227e27db90` ON `ecosystem_model` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_bde98d59e8984e7d17034c3b93` ON `actor_group` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_a2afa3851ea733de932251b3a1` ON `actor` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_7fbe50fa78a37776ad962cb764` ON `community` (`communicationId`)', | |
'CREATE UNIQUE INDEX `IDX_6e7584bfb417bd0f8e8696ab58` ON `community` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_3b8f390d76263ef5996869da07` ON `community` (`roleSetId`)', | |
'CREATE UNIQUE INDEX `IDX_2e7dd2fa8c829352cfbecb2cc9` ON `community` (`guidelinesId`)', | |
'CREATE UNIQUE INDEX `IDX_b038f74c8d4eadb839e78b99ce` ON `role_set` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_00905b142498f63e76d38fb254` ON `role_set` (`applicationFormId`)', | |
'CREATE UNIQUE INDEX `IDX_b132226941570cb650a4023d49` ON `invitation` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_b0c80ccf319a1c7a7af12b3998` ON `invitation` (`lifecycleId`)', | |
'CREATE UNIQUE INDEX `IDX_7ec2857c7d8d16432ffca1cb3d` ON `application` (`lifecycleId`)', | |
'CREATE UNIQUE INDEX `IDX_56f5614fff0028d40370499582` ON `application` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_b61c694cacfab25533bd23d9ad` ON `user` (`agentId`)', | |
'CREATE UNIQUE INDEX `IDX_9466682df91534dd95e4dbaa61` ON `user` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_10458c50c10436b6d589b40e5c` ON `user` (`storageAggregatorId`)', | |
'CREATE UNIQUE INDEX `IDX_09f909622aa177a097256b7cc2` ON `user` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_028322b763dc94242dc9f638f9` ON `user` (`preferenceSetId`)', | |
'CREATE UNIQUE INDEX `IDX_c0448d2c992a62c9c11bd0f142` ON `platform_invitation` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_f516dd9a46616999c7e9a6adc1` ON `platform` (`storageAggregatorId`)', | |
'CREATE UNIQUE INDEX `IDX_dd88d373c64b04e24705d575c9` ON `platform` (`forumId`)', | |
'CREATE UNIQUE INDEX `IDX_ca469f5ec53a7719d155d60aca` ON `platform` (`libraryId`)', | |
'CREATE UNIQUE INDEX `IDX_9f621c51dd854634d8766a9cfa` ON `platform` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_425bbb4b951f7f4629710763fc` ON `platform` (`licensingId`)', | |
'CREATE UNIQUE INDEX `IDX_3b0c92945f36d06f37de80285d` ON `forum` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_5337074c9b818bb63e6f314c80` ON `discussion` (`commentsId`)', | |
'CREATE UNIQUE INDEX `IDX_4555dccdda9ba57d8e3a634cd0` ON `discussion` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_2d8a3ca181c3f0346817685d21` ON `discussion` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_a5dae5a376dd49c7c076893d40` ON `licensing` (`licensePolicyId`)', | |
'CREATE UNIQUE INDEX `IDX_0c6a4d0a6c13a3f5df6ac01509` ON `licensing` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_23d4d78ea8db637df031f86f03` ON `license_policy` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_3879db652f2421337691219ace` ON `library` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_684b272e6f7459439d41d2879e` ON `community_guidelines` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_3d60fe4fa40d54bad7d51bb4bd` ON `community_guidelines` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_eb99e588873c788a68a035478a` ON `communication` (`updatesId`)', | |
'CREATE UNIQUE INDEX `IDX_a20c5901817dd09d5906537e08` ON `communication` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_e8e32f1e59c349b406a4752e54` ON `user_group` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_9912e4cfc1e09848a392a65151` ON `user_group` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_e0e150e4f11d906b931b46a2d8` ON `organization` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_d2cb77c14644156ec8e865608e` ON `organization` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_7f1bec8979b57ed7ebd392a2ca` ON `organization` (`agentId`)', | |
'CREATE UNIQUE INDEX `IDX_5a72d5b37312bac2e0a0115718` ON `organization` (`verificationId`)', | |
'CREATE UNIQUE INDEX `IDX_58fd47c4a6ac8df9fe2bcaed87` ON `organization` (`preferenceSetId`)', | |
'CREATE UNIQUE INDEX `IDX_395aa74996a1f978b4969d114b` ON `organization` (`storageAggregatorId`)', | |
'CREATE UNIQUE INDEX `IDX_8ed9d1af584fa62f1ad3405b33` ON `agent` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_8e76dcf171c45875c44febb1d8` ON `preference_set` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_b4cf0f96bf08cf396f68355522` ON `preference` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_c66eddab0caacb1ef8d46bcafd` ON `organization_verification` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_1cc3b275fc2a9d9d9b0ae33b31` ON `organization_verification` (`lifecycleId`)', | |
'CREATE UNIQUE INDEX `IDX_f67a2d25c945269d602c182fbc` ON `collaboration` (`timelineId`)', | |
'CREATE UNIQUE INDEX `IDX_b7ece56376ac7ca0b9a56c33b3` ON `collaboration` (`tagsetTemplateSetId`)', | |
'CREATE UNIQUE INDEX `IDX_35c6b1de6d4d89dfe8e9c85d77` ON `collaboration` (`innovationFlowId`)', | |
'CREATE UNIQUE INDEX `IDX_262ecf3f5d70b82a4833618425` ON `collaboration` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_a6e050daa4c7a3ab1e411c3651` ON `innovation_flow` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_96a8cbe1706f459fd7d883be9b` ON `innovation_flow` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_5fe58ece01b48496aebc04733d` ON `timeline` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_56aae15a664b2889a1a11c2cf8` ON `timeline` (`calendarId`)', | |
'CREATE UNIQUE INDEX `IDX_6e74d59afda096b68d12a69969` ON `calendar` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_b5069b11030e9608ee4468f850` ON `calendar_event` (`commentsId`)', | |
'CREATE UNIQUE INDEX `IDX_9349e137959f3ca5818c2e62b3` ON `calendar_event` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_8ee86afa2808a4ab523b9ee6c5` ON `calendar_event` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_cf776244b01436d8ca5cc76284` ON `callout` (`framingId`)', | |
'CREATE UNIQUE INDEX `IDX_62ed316cda7b75735b20307b47` ON `callout` (`commentsId`)', | |
'CREATE UNIQUE INDEX `IDX_6289dee12effb51320051c6f1f` ON `callout` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_36b0da55acff774d0845aeb55f` ON `callout` (`contributionDefaultsId`)', | |
'CREATE UNIQUE INDEX `IDX_1e740008a7e1512966e3b08414` ON `callout` (`contributionPolicyId`)', | |
'CREATE UNIQUE INDEX `IDX_dfa86c46f509a61c6510536cd9` ON `callout_contribution` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_bdf2d0eced5c95968a85caaaae` ON `callout_contribution` (`linkId`)', | |
'CREATE UNIQUE INDEX `IDX_97fefc97fb254c30577696e1c0` ON `callout_contribution` (`postId`)', | |
'CREATE UNIQUE INDEX `IDX_5e34f9a356f6254b8da24f8947` ON `callout_contribution` (`whiteboardId`)', | |
'CREATE UNIQUE INDEX `IDX_3bfc8c1aaec1395cc148268d3c` ON `link` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_07f249ac87502495710a62c5c0` ON `link` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_970844fcd10c2b6df7c1b49eac` ON `post` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_390343b22abec869bf80041933` ON `post` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_042b9825d770d6b3009ae206c2` ON `post` (`commentsId`)', | |
'CREATE UNIQUE INDEX `IDX_f53e2d266432e58e538a366705` ON `callout_framing` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_c9d7c2c4eb8a1d012ddc6605da` ON `callout_framing` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_8bc0e1f40be5816d3a593cbf7f` ON `callout_framing` (`whiteboardId`)', | |
'CREATE UNIQUE INDEX `IDX_d3b86160bb7d704212382b0ca4` ON `whiteboard` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_3f9e9e2798d2a4d84b16ee8477` ON `whiteboard` (`profileId`)', | |
'CREATE UNIQUE INDEX `IDX_d1d94dd8e0c417b4188a05ccbc` ON `room` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_73e8ae665a49366ca7e2866a45` ON `reference` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_a96475631aba7dce41db03cc8b` ON `profile` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_4a1c74fd2a61b32d9d9500e065` ON `profile` (`storageBucketId`)', | |
'CREATE UNIQUE INDEX `IDX_432056041df0e4337b17ff7b09` ON `profile` (`locationId`)', | |
'CREATE UNIQUE INDEX `IDX_f2f48b57269987b13b415a0058` ON `storage_bucket` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_f3b4d59c0b805c9c1ecb0070e1` ON `storage_aggregator` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_0647707288c243e60091c8d862` ON `storage_aggregator` (`directStorageId`)', | |
'CREATE UNIQUE INDEX `IDX_d9e2dfcccf59233c17cc6bc641` ON `document` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_9fb9257b14ec21daf5bc9aa4c8` ON `document` (`tagsetId`)', | |
'CREATE UNIQUE INDEX `IDX_4fbd109f9bb84f58b7a3c60649` ON `visual` (`authorizationId`)', | |
'CREATE UNIQUE INDEX `IDX_eb59b98ee6ef26c993d0d75c83` ON `tagset` (`authorizationId`)', | |
]; | |
for (const query of indexesToCreate) { | |
await queryRunner.query(query); | |
} | |
} |
public async down(queryRunner: QueryRunner): Promise<void> { | ||
// Logic for down migration can be added here if needed | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implement the down
method to make the migration reversible
Currently, the down
method is empty, which means this migration cannot be reversed. Implementing the down
method ensures that migrations are reversible and helps maintain database integrity.
Would you like assistance in implementing the down
method to restore the dropped indexes, foreign keys, and unique constraints?
const foreignKeysResult = await queryRunner.query(` | ||
SELECT TABLE_NAME, CONSTRAINT_NAME | ||
FROM information_schema.KEY_COLUMN_USAGE | ||
WHERE CONSTRAINT_SCHEMA = '${dbName}' | ||
AND REFERENCED_TABLE_NAME IS NOT NULL; | ||
`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameterize SQL queries to prevent SQL injection
Directly interpolating variables into SQL queries can lead to SQL injection vulnerabilities. Even if dbName
is controlled, it's best practice to use parameterized queries.
[security]
Apply this diff to parameterize the query:
- const foreignKeysResult = await queryRunner.query(`
- SELECT TABLE_NAME, CONSTRAINT_NAME
- FROM information_schema.KEY_COLUMN_USAGE
- WHERE CONSTRAINT_SCHEMA = '${dbName}'
- AND REFERENCED_TABLE_NAME IS NOT NULL;
- `);
+ const foreignKeysResult = await queryRunner.query(
+ `SELECT TABLE_NAME, CONSTRAINT_NAME
+ FROM information_schema.KEY_COLUMN_USAGE
+ WHERE CONSTRAINT_SCHEMA = ?
+ AND REFERENCED_TABLE_NAME IS NOT NULL;`,
+ [dbName]
+ );
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const foreignKeysResult = await queryRunner.query(` | |
SELECT TABLE_NAME, CONSTRAINT_NAME | |
FROM information_schema.KEY_COLUMN_USAGE | |
WHERE CONSTRAINT_SCHEMA = '${dbName}' | |
AND REFERENCED_TABLE_NAME IS NOT NULL; | |
`); | |
const foreignKeysResult = await queryRunner.query( | |
`SELECT TABLE_NAME, CONSTRAINT_NAME | |
FROM information_schema.KEY_COLUMN_USAGE | |
WHERE CONSTRAINT_SCHEMA = ? | |
AND REFERENCED_TABLE_NAME IS NOT NULL;`, | |
[dbName] | |
); |
const uniqueConstraintsResult = await queryRunner.query(` | ||
SELECT TABLE_NAME, CONSTRAINT_NAME | ||
FROM information_schema.TABLE_CONSTRAINTS | ||
WHERE CONSTRAINT_SCHEMA = '${dbName}' | ||
AND CONSTRAINT_TYPE = 'UNIQUE'; | ||
`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameterize SQL queries to prevent SQL injection
Avoid interpolating dbName
directly into SQL queries. Use parameterized queries to enhance security.
[security]
Apply this diff:
- const uniqueConstraintsResult = await queryRunner.query(`
- SELECT TABLE_NAME, CONSTRAINT_NAME
- FROM information_schema.TABLE_CONSTRAINTS
- WHERE CONSTRAINT_SCHEMA = '${dbName}'
- AND CONSTRAINT_TYPE = 'UNIQUE';
- `);
+ const uniqueConstraintsResult = await queryRunner.query(
+ `SELECT TABLE_NAME, CONSTRAINT_NAME
+ FROM information_schema.TABLE_CONSTRAINTS
+ WHERE CONSTRAINT_SCHEMA = ?
+ AND CONSTRAINT_TYPE = 'UNIQUE';`,
+ [dbName]
+ );
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const uniqueConstraintsResult = await queryRunner.query(` | |
SELECT TABLE_NAME, CONSTRAINT_NAME | |
FROM information_schema.TABLE_CONSTRAINTS | |
WHERE CONSTRAINT_SCHEMA = '${dbName}' | |
AND CONSTRAINT_TYPE = 'UNIQUE'; | |
`); | |
const uniqueConstraintsResult = await queryRunner.query( | |
`SELECT TABLE_NAME, CONSTRAINT_NAME | |
FROM information_schema.TABLE_CONSTRAINTS | |
WHERE CONSTRAINT_SCHEMA = ? | |
AND CONSTRAINT_TYPE = 'UNIQUE';`, | |
[dbName] | |
); |
console.error( | ||
`Could not drop index ${index.INDEX_NAME} on table ${index.TABLE_NAME}:`, | ||
error | ||
); | ||
continue; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unnecessary continue
statement in catch block
The continue
statement at line 95 is unnecessary because it's at the end of the loop body.
Apply this diff:
console.error(
`Could not drop index ${index.INDEX_NAME} on table ${index.TABLE_NAME}:`,
error
);
- continue;
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
console.error( | |
`Could not drop index ${index.INDEX_NAME} on table ${index.TABLE_NAME}:`, | |
error | |
); | |
continue; | |
} | |
console.error( | |
`Could not drop index ${index.INDEX_NAME} on table ${index.TABLE_NAME}:`, | |
error | |
); | |
} |
🧰 Tools
🪛 Biome
[error] 95-95: Unnecessary continue statement
Unsafe fix: Delete the unnecessary continue statement
(lint/correctness/noUnnecessaryContinue)
Tested OK locally with ACC db |
Very lame and slow approach, cleaning up + fixing indexes. There were broken indexes with the Roles migration and there wasn't an easy universal fix.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation