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.
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
Add composite foreign key #1385
Add composite foreign key #1385
Changes from 8 commits
66af6fc
11502f8
2487676
83c38be
45bbff3
923f499
65ac95d
0bc2ba1
b8aeffa
f14214a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I guess that check that size of
from
andtarget.columns
is the same. Also, maybe it's worth to check column types?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.
Added check for collections sizes. But columns type check is rather tricky - naive type equality check (
from.columnType == target.columnType
) will be too restrictive because SQL (at least postgreSQL) allows:INT
toSERIAL
INT NOT NULL
toINT NULL
(and vice versa!)VARCHAR(50)
toVARCHAR(100)
(and vice versa!)INT
/SMALLINT
toBIGINT
(and vice versa!)And definitely, this list is not exhaustive - it's just my experiments in sqlfiddle
So, the new method
IColumnType.isCompatibleWith(other: IColumnType) : Boolean
needs to be added first to make this check possible. But it looks like a big research task, at least I couldn't quickly find any docs about types compatibility (which type could be referenced to which in foreign key constraint) for any of SQL dialects.