drizzle-team / drizzle-team/drizzle-orm

[BUG]: SERIAL type (postgress) is used in the libsql migrator script.

Open Beginner friendly
#5,669 0 comments 0 reactions 0 assignees View on GitHub
bug bug/fixed-in-beta
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [x] I have verified that the bug I'm about to report hasn't been filed before.

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

0.45.2

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

0.31.10

### Other packages

_No response_

### Describe the Bug

After creating the __drizzle_migrations table, the ID is NULL on running migrations.

This is because in the https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/libsql/migrator.ts migrator file, the ID is set as type `SERIAL` which is a Postgres type. libsql doesn't have `SERIAL`. Here's the issue:

```
CREATE TABLE IF NOT EXISTS ${sql.identifier(migrationsTable)} (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at numeric

```

Should instead be:

```
CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (
id INTEGER PRIMARY KEY AUTOINCREMENT,
hash TEXT NOT NULL,
created_at NUMERIC
```

Contributor guide

Open the contributing guide

Research direction

Open drizzle-orm/src/libsql/migrator.ts and inspect the SQL that creates the __drizzle_migrations table. Reproduce a migration against libsql, then verify that the table assigns a non-NULL ID and that migrations complete successfully. Add or update the focused libsql migrator test if one exists, and run the relevant test suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
sqlite, typescript
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.