drizzle-team / drizzle-team/drizzle-orm

[BUG]: Introspect migration has unterminated comment

Open
#2,126 7 comments 3 reactions 0 assignees View on GitHub
bug drizzle/kit priority
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### What version of `drizzle-orm` are you using?

0.30.7

### What version of `drizzle-kit` are you using?

0.20.14

### Describe the Bug

1. Have an existing Prisma DB
2. Create drizzle config
3. Run `drizzle-kit introspect:pg`
4. Run the generated migration

It throws
```
error: unterminated /* comment at or near "/*
DO $$ BEGIN
CREATE TYPE "UserRole" AS ENUM('ADMIN', 'USER');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
"
error: unterminated /* comment at or near "/*
DO $$ BEGIN
CREATE TYPE "UserRole" AS ENUM('ADMIN', 'USER');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
"
```

### Expected behavior

It shouldn't do anything since the whole migration is commented

The initial migration looks like this
```sql
-- Current sql file was generated after introspecting the database
-- If you want to run this migration please uncomment this code before executing migrations
/*
DO $$ BEGIN
CREATE TYPE "UserRole" AS ENUM('ADMIN', 'USER');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

-- Rest of the migration
-- ...
```

### Environment & setup

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.