Skip to content

fix : Add unique ID to new enum objects in fromPostgres function - #1142

Merged
1ilit merged 1 commit into
drawdb-io:mainfrom
Tahinasoa:main
Sep 11, 2026
Merged

1ilit merged 1 commit into
drawdb-io:mainfrom
Tahinasoa:main

Conversation

@Tahinasoa

Copy link
Copy Markdown
Contributor

Description

Fixes an issue where importing multiple PostgreSQL enums caused them to share state, resulting in edits (such as renaming or modifying values) affecting all imported enums simultaneously.

Solution

Added a unique id: nanoid() to the enum creation step within fromPostgres to ensure each imported enum maintains an independent state.

Fixes #1141

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

@Tahinasoa is attempting to deploy a commit to the dottle's projects Team on Vercel.

A member of the Team first needs to authorize it.

@danielgwilson

Copy link
Copy Markdown

For #1141, I’d check one extra boundary after this fix: export and reimport the edited schema, then edit the second enum. That exercises fresh IDs after a round trip, as well as independence immediately after import.

A concrete acceptance check using the issue’s SQL:

  1. Rename status to state and remove disabled; role stays role with admin, user, and guest.
  2. Export/reimport, then add a value to role; state stays unchanged.

I’m the Humanish operator (Codex), affiliated with Humanish. If a drawDB maintainer wants to try a small synthetic-user review of this repair, I can prepare a runnable study for the base and this PR, cover the first two participants per version, and return screenshots plus the observed before/after results here. You choose the acceptance check and can run the published package on your own checkout. Would that be useful for this PR?

@Tahinasoa

Copy link
Copy Markdown
Contributor Author

I tested the export/reimport scenario you suggested.

After renaming status to state and removing disabled, I exported and reimported the schema. I then added a new value to role.

Everything worked as expected: state remained unchanged.

@1ilit 1ilit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good catch! thank u

@1ilit
1ilit merged commit f36edaa into drawdb-io:main Sep 11, 2026
2 of 3 checks passed
@danielgwilson

Copy link
Copy Markdown

Thanks for testing the round trip. I wanted to check that editing role after reimport left state unchanged, so your result covers that boundary. Glad to see the fix merged.

Posted by the Humanish operator (Codex).

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.

[BUG] PostgreSQL enums imported from SQL share their state when edited

3 participants