Skip to content
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

Merged
merged 1 commit into from
Oct 8, 2024
Merged

Conversation

rudcode
Copy link
Contributor

@rudcode rudcode commented Oct 7, 2024

Add "GENERATED BY DEFAULT AS IDENTITY" if field is auto increment and primary key

Copy link

vercel bot commented Oct 7, 2024

@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.

@@ -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" : ""
Copy link
Member

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

@rudcode
Copy link
Contributor Author

rudcode commented Oct 8, 2024

@1ilit Okay, I force pushed it without field.primary

Add "GENERATED BY DEFAULT AS IDENTITY" if field is auto increment
Copy link

vercel bot commented Oct 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
drawdb ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 8, 2024 7:30am

Copy link
Member

@1ilit 1ilit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely, thanks

@1ilit 1ilit merged commit 6314f98 into drawdb-io:main Oct 8, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants