-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
fix(sqlite): describeTable now returns unique constraint and references #12420
fix(sqlite): describeTable now returns unique constraint and references #12420
Conversation
Tests are failing |
Other dialects appear to be failing on the new tests that I created. It appears other dialects don't return the |
be3dff4
to
250c74e
Compare
Also, should I rebase this branch to target |
ed46562
to
5bceb3f
Compare
|
5bceb3f
to
3be8877
Compare
I'm unsure why the tests are failing now, I tried running the postgres dialect integration tests on the master branch and those aren't successful. I'm unable to run the integration tests for mssql, mysql, and mariadb for some reason. |
Oh, nevermind. It looks like just appveyor is failing now. Something to do with uploading code coverage? |
I'll start working on preserving foreign keys tomorrow, if I can figure out how that works. |
ae8cef1
to
b5f8711
Compare
@@ -418,7 +418,8 @@ class SQLiteQueryGenerator extends MySqlQueryGenerator { | |||
).join(', '); | |||
const attributeNamesExport = Object.keys(attributes).map(attr => this.quoteIdentifier(attr)).join(', '); | |||
|
|||
return `${this.createTableQuery(backupTableName, attributes).replace('CREATE TABLE', 'CREATE TEMPORARY TABLE') | |||
// Temporary tables don't support foreign keys, so creating a temporary table will not allow foreign keys to be preserved | |||
return `${this.createTableQuery(backupTableName, attributes) |
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.
👍
LGTM @dyc3 , ready for merge? |
@sushantdhiman Yup! |
🎉 This PR is included in version 6.2.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Pull Request check-list
Please make sure to review and check all of these items:
npm run test
ornpm run test-DIALECT
pass with this change (including linting)?Description of change
Fixes #7078
For the sqlite dialect, I added an additional query for describeTable to get the constraints for the columns via showIndexes. I also added a new test for this behavior, and updated existing tests to reflect the new behavior. Currently, this only fixes unique constraints.
I'm intentionally making this a draft until we can fix the foreign key thing because I don't know how those work, and so we can put this fix in v5 as well.
I'm also not really sure if the changes I made to the tests are valid