-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 postgres auto increment primary key #255
Conversation
@rudcode is attempting to deploy a commit to the dottle's projects Team on Vercel. A member of the Team first needs to authorize it. |
src/utils/exportSQL/postgres.js
Outdated
@@ -32,6 +32,8 @@ export function toPostgres(diagram) { | |||
`${exportFieldComment(field.comment)}\t"${ | |||
field.name | |||
}" ${field.type}${field.isArray ? " ARRAY" : ""}${field.notNull ? " NOT NULL" : ""}${field.unique ? " UNIQUE" : ""}${ | |||
field.increment && field.primary ? " GENERATED BY DEFAULT AS IDENTITY" : "" |
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.
No need for && field.primary
. It doesn't have to be a primary key to be auto incremented
@1ilit Okay, I force pushed it without field.primary |
Add "GENERATED BY DEFAULT AS IDENTITY" if field is auto increment
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Lovely, thanks
Add "GENERATED BY DEFAULT AS IDENTITY" if field is auto increment and primary key