v1.9.25 - Feature: dialect.foreignKeyCreatesImplicitIndex#140
Merged
v1.9.25 - Feature: dialect.foreignKeyCreatesImplicitIndex#140
Conversation
- `TableFieldReference`:
- Added nullable field `indexName` to represent the name of the index if one exists.
- Added new class `TableRelationshipReferenceEntityTyped` extending `TableRelationshipReference`:
- Adds `sourceFieldEntityType` and `targetFieldEntityType` fields of type `TypeInfo`.
- Provides `copyWithEntityTypes` method to create typed copies.
- `TableRelationshipReference`:
- Added nullable fields `sourceRelationshipFieldIndex` and `targetRelationshipFieldIndex`.
- Added `copyWithEntityTypes` method returning `TableRelationshipReferenceEntityTyped`.
- `EntityHandler`:
- Added `getFieldsListEntityTypes` method to return a map of fields that are list entities or references with their `TypeInfo`.
- `SQLDialect`:
- Added `foreignKeyCreatesImplicitIndex` boolean flag with default `true`.
- `DBPostgreSQLAdapter`:
- Added `foreignKeyCreatesImplicitIndex` flag to PostgreSQL dialect set to `false`.
- Updated `_findAllTableFieldsReferences` query to include foreign key index name (`fk_index_name`) by joining with `pg_index` and `pg_class`.
- Populated `indexName` in `TableFieldReference` instances from query result.
- Updated relationship references to include `sourceRelationshipFieldIndex` and `targetRelationshipFieldIndex` from `indexName`.
- `DBSQLAdapter`:
- Added detection of missing foreign key indexes when dialect does not create implicit indexes.
- Added detection of missing relationship reference indexes for collection reference fields.
- Updated error reporting and logging to include missing reference indexes and relationship reference indexes.
- Updated `_checkDBTableSchemeReferenceField` to return `TableRelationshipReferenceEntityTyped` with entity types.
- Added generation of missing reference indexes and missing relationship reference indexes SQL statements.
- Updated `_DBTableCheck` class:
- Added fields `missingReferenceIndexes` and `missingRelationshipReferenceIndexes`.
- Added methods to generate missing reference indexes and relationship reference indexes SQL.
- Added `_DBRelationshipTableColumn` subclass of `_DBTableColumn` to represent relationship table columns with relationship table name.
- Updated SQL generation to create indexes for foreign keys if dialect does not create implicit indexes:
- Added index creation after foreign key constraints in `generateAddColumnAlterTableSQL`.
- Added index creation for relationship table foreign keys in relationship table creation SQL.
- Dependency updates:
- `async_extension`: ^1.2.19 → ^1.2.20
- `meta`: ^1.18.0 → ^1.18.1
…om `List<bool>` to a record with named fields `(generateTables, checkTables)`.
…ements in addition to `CREATE` and `ALTER TABLE`.
- Added field `createIndexIfNotExists` to indicate support for `IF NOT EXISTS` in `CREATE INDEX` (default `true`). - `CreateIndexSQL`: - Updated `buildSQL` method to conditionally include `IF NOT EXISTS` only if dialect supports it.
- Added field `createIndexIfNotExists` to indicate support for `IF NOT EXISTS` in `CREATE INDEX` (default `true`). - `CreateIndexSQL`: - Updated `buildSQL` method to conditionally include `IF NOT EXISTS` only if dialect supports it.
- `_populateTablesFromSQLsImpl`: fixed error handling for `CREATE INDEX` statements when the SQL dialect does not support `IF NOT EXISTS`.
- Now logs a warning and ignores the error instead of throwing.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #140 +/- ##
==========================================
- Coverage 65.49% 65.46% -0.03%
==========================================
Files 62 62
Lines 21000 21164 +164
==========================================
+ Hits 13754 13856 +102
- Misses 7246 7308 +62
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TableFieldReference:indexNameto represent the name of the index if one exists.Added new class
TableRelationshipReferenceEntityTypedextendingTableRelationshipReference:sourceFieldEntityTypeandtargetFieldEntityTypefields of typeTypeInfo.copyWithEntityTypesmethod to create typed copies.TableRelationshipReference:sourceRelationshipFieldIndexandtargetRelationshipFieldIndex.copyWithEntityTypesmethod returningTableRelationshipReferenceEntityTyped.EntityHandler:getFieldsListEntityTypesmethod to return a map of fields that are list entities or references with theirTypeInfo.SQLDialect:foreignKeyCreatesImplicitIndexboolean flag with defaulttrue.DBPostgreSQLAdapter:foreignKeyCreatesImplicitIndexflag to PostgreSQL dialect set tofalse._findAllTableFieldsReferencesquery to include foreign key index name (fk_index_name) by joining withpg_indexandpg_class.indexNameinTableFieldReferenceinstances from query result.sourceRelationshipFieldIndexandtargetRelationshipFieldIndexfromindexName.DBSQLAdapter:_checkDBTableSchemeReferenceFieldto returnTableRelationshipReferenceEntityTypedwith entity types._DBTableCheckclass:missingReferenceIndexesandmissingRelationshipReferenceIndexes._DBRelationshipTableColumnsubclass of_DBTableColumnto represent relationship table columns with relationship table name.generateAddColumnAlterTableSQL.Dependency updates:
async_extension: ^1.2.19 → ^1.2.20meta: ^1.18.0 → ^1.18.1