drizzle-team / drizzle-team/drizzle-orm
[BUG]: Turso Introspection is empty
- 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.31.2
### What version of `drizzle-kit` are you using?
0.22.6
### Describe the Bug
I created a Turso database `drizzle-test` with a simple table `untitled_table_1` with two columns.
```ts
export const temp = sqliteTable('untitled_table_1', {
id: text('id').primaryKey(),
name: text('name').notNull(),
})
```
```sh
> npx drizzle-kit push
drizzle-kit: v0.22.6
drizzle-orm: v0.31.2
No config path provided, using default path
Reading config file '.../drizzle.config.ts'
[✓] Pulling schema from database...
Warning You are about to execute current statements:
CREATE TABLE `untitled_table_1` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL
);
[✓] Changes applied
```
I connected to the new database and table and manually seeded two rows of data just to make sure (tested both with and without data)
Turso web ui view:

TablePlus view:

`drizzle-kit introspect` output:
```sh
> ❯ npx drizzle-kit introspect
drizzle-kit: v0.22.6
drizzle-orm: v0.31.2
No config path provided, using default path
Reading config file '.../drizzle.config.ts'
Pulling from ['public'] list of schemas
[✓] 0 tables fetched
[✓] 0 columns fetched
[✓] 0 indexes fetched
[✓] 0 foreign keys fetched
[✓] Your SQL migration file ➜ drizzle/0000_true_the_call.sql 🚀
[✓] You schema file is ready ➜ drizzle/schema.ts 🚀
[✓] You relations file is ready ➜ drizzle/relations.ts 🚀
```
Since the introspection isn't working correctly, subsequent runs of `drizzle-kit push` will fail because it will attempt to create the table again.
```sh
npx drizzle-kit push
drizzle-kit: v0.22.6
drizzle-orm: v0.31.2
No config path provided, using default path
Reading config file '.../drizzle.config.ts'
[✓] Pulling schema from database...
Warning You are about to execute current statements:
CREATE TABLE `untitled_table_1` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL
);
LibsqlError: SQL_INPUT_ERROR: SQL input error: table `untitled_table_1` already exists (at offset 13)
at mapHranaError (.../node_modules/@libsql/client/lib-esm/hrana.js:262:16)
at HttpClient.execute (.../node_modules/@libsql/client/lib-esm/http.js:80:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.run (.../drizzle-kit/bin.cjs:119857:15)
at async sqlitePush (.../node_modules/drizzle-kit/bin.cjs:122665:13)
at async _Command. (.../node_modules/drizzle-kit/bin.cjs:129712:7) {
code: 'SQL_INPUT_ERROR',
rawCode: undefined,
[cause]: [ResponseError: SQL input error: table `untitled_table_1` already exists (at offset 13)] {
code: 'SQL_INPUT_ERROR',
proto: {
message: 'SQL input error: table `untitled_table_1` already exists (at offset 13)',
code: 'SQL_INPUT_ERROR'
}
}
```
I'm using @libsql/client v0.6.2 if that is relevant.
### Expected behavior
_No response_
### Environment & setup
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.