Repository navigation
Conversation
Codecov Report
@@ Coverage Diff @@
## v5 #12019 +/- ##
===========================================
+ Coverage 85.50% 96.27% +10.76%
===========================================
Files 89 94 +5
Lines 8806 9189 +383
===========================================
+ Hits 7530 8847 +1317
+ Misses 1276 342 -934
Continue to review full report at Codecov.
|
sushantdhiman
left a comment
There was a problem hiding this comment.
Current solution will not work with schemas. Please fix that and add an extra integration test for schema case as well
| } | ||
|
|
||
| let sql = `CREATE TYPE ${enumName} AS ${values};`; | ||
| let sql = `DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'enum_${ tableName }_${ attr }') THEN CREATE TYPE ${ enumName } AS ${ values }; END IF; END$$;`; |
There was a problem hiding this comment.
typname = 'enum_${ tableName }_${ attr }' it should check for enumName, like this typname='${enumName}'
There was a problem hiding this comment.
This solution will not work with schemas, try this https://stackoverflow.com/a/48382296
|
the fix is so damn straight-forward and desired by the community but you're doing things unacceptably slow @sushantdhiman 👎 |
Unfortunately, I don't have time for this PR right now. Feel free to complete it if you know what to do. |
|
I can confirm this does fix the issue of postgres enum types updating correctly after more than run of |
Pull Request check-list
Please make sure to review and check all of these items:
npm run testornpm run test-DIALECTpass with this change (including linting)?Description of change
Closes #7649
This change fixes an error that occurs when calling
sync({ alter : true })on a model with the ENUM data type.The solution is taken from #7649 (comment) by @GrigoryGraborenko.