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

[BUG]: Migrations does not escape single quotes #1765

Closed
isaacfink opened this issue Jan 7, 2024 · 2 comments
Closed

[BUG]: Migrations does not escape single quotes #1765

isaacfink opened this issue Jan 7, 2024 · 2 comments
Assignees
Labels
bug Something isn't working db/postgres drizzle/kit priority Will be worked on next

Comments

@isaacfink
Copy link

What version of drizzle-orm are you using?

0.29.3

What version of drizzle-kit are you using?

0.20.9

Describe the Bug

I have this line in an enum

export const genres = pgEnum('genres', [
    "Thriller",
    "Young Adult",
    "Children's",
    "Historical Fiction",
    "Autobiography"
])

which generates the following migration

DO $$ BEGIN
 CREATE TYPE "genres" AS ENUM('Thriller', 'Young Adult', 'Children's', 'Historical Fiction', 'Autobiography');
EXCEPTION
 WHEN duplicate_object THEN null;
END $$;

Which causes the following sql error

PostgresError: unterminated quoted string at or near "');
EXCEPTION
 WHEN duplicate_object THEN null;
END "

Expected behavior

the migration should instead look like this

DO $$ BEGIN
 CREATE TYPE "genres" AS ENUM('Thriller', 'Young Adult', 'Children''s', 'Historical Fiction', 'Autobiography');
EXCEPTION
 WHEN duplicate_object THEN null;
END $$;

Environment & setup

Postgres, node, pnpm

@isaacfink isaacfink added the bug Something isn't working label Jan 7, 2024
@AndriiSherman AndriiSherman self-assigned this Feb 5, 2024
@AndriiSherman
Copy link
Member

Good catch, will work on this

@AndriiSherman
Copy link
Member

Was fixed in [email protected]

@github-project-automation github-project-automation bot moved this from Backlog to Done in Public Roadmap Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working db/postgres drizzle/kit priority Will be worked on next
Projects
Status: Done
Development

No branches or pull requests

4 participants