drizzle-team / drizzle-team/drizzle-orm
[BUG]: Changing a column type from `varchar` to `serial` causes incorrect migration sql to be generated
- 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.27.0
### What version of `drizzle-kit` are you using?
0.19.2
### Describe the Bug
Create a schema:
```typescript
export const users = pgTable("users", {
id: text("id").primaryKey(),
name: text("name").notNull(),
});
```
Generate and run migration.
Alter the schema:
```typescript
export const users = pgTable("users", {
id: serial("id").primaryKey(),
name: text("name").notNull(),
});
```
Generate the migration:
```sql
ALTER TABLE "users" ALTER COLUMN "id" SET DATA TYPE serial;--> statement-breakpoint
```
Run the migration
The following error occurs
```bash
PostgresError: type "serial" does not exist
```
### Expected behavior
The migration is successful
### Environment & setup
Linux, posgres 14
Contributor guide
Assessment
This issue has not been assessed yet.