-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
feat: allow explicitly named primary keys, foreign keys, and indices #8900
Merged
Conversation
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
Add a constraintName to JoinColumn decorators to allow specifying foreignKey name. Use constraintName when building JoinTable entities as well. Partially solves: #1355
Add constraintName property with correct variable undefined to snapshot in tests for issue 5444.
# Conflicts: # docs/decorator-reference.md # src/decorator/options/JoinColumnOptions.ts # src/decorator/relations/JoinColumn.ts # src/entity-schema/EntitySchemaTransformer.ts # src/metadata-args/JoinColumnMetadataArgs.ts # src/metadata-builder/JunctionEntityMetadataBuilder.ts # src/metadata/ColumnMetadata.ts # src/metadata/ForeignKeyMetadata.ts # test/github-issues/5444/issue-5444.ts
added test;
Beautiful |
This would be huge for my team's current migration. Much love ❤️ |
7 tasks
7 tasks
Much appreciated! |
Is there a way to pass export const UserSchema = new EntitySchema({
name: 'User',
columns: {
id: {
primary: true,
type: 'uuid',
// primaryKeyConstraintName: 'PK_user_id', // <--- There is no such key 😔
},
},
}); Thanks in advance! |
Should be resolved at #9309 |
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.
Description of change
Includes changes from #8524, fixes issues with existing custom constraint names (indices, uniques) and adds support for custom primary key constraint names.
Custom FK names:
Custom PK names:
Fixes #1355
Fixes #4572
Fixes #8321
Closes #8524
Pull-Request Checklist
master
branchnpm run format
to apply prettier formattingnpm run test
passes with this changeFixes #0000