Theo Ribeiro
Theo Ribeiro
DTDrizzle Team
Created by Theo Ribeiro on 5/12/2024 in #help
Can’t drop tables with SQLite (actually libSQL on Turso) using either sql or sql.raw queries
Hi all, I'm using Drizzle with SQLite (actually libSQL on Turso) and I can’t seem to be able to drop tables using either sql or sql.raw queries: await db.run(sqlDROP TABLE IF EXISTS users;); await db.run(sql.raw(DROP TABLE IF EXISTS users;)); btw, the backticks aren't missing in the sql or sql.raw statements above, they just get removed here by discord. I can run most other SQL queries this way and I tried quite a few to make sure I wasn’t doing anything silly. When I run my typescript file that include any of the above, I get the following in my terminal: Query: DROP TABLE IF EXISTS users; /Users/theorib/Development/film-credits/node_modules/.pnpm/@[email protected]/node_modules/@libsql/client/lib-cjs/hrana.js:287 return new api_1.LibsqlError(e.message, code, undefined, e); ^ LibsqlError: SQLITE_UNKNOWN: SQLite error: no such table: main.compositionSettings at mapHranaError (/Users/theorib/Development/film-credits/node_modules/.pnpm/@[email protected]/node_modules/@libsql/client/lib-cjs/hrana.js:287:16) at HttpClient.execute (/Users/theorib/Development/film-credits/node_modules/.pnpm/@[email protected]/node_modules/@libsql/client/lib-cjs/http.js:87:48) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at <anonymous> (/Users/theorib/Development/film-credits/src/db/clearDb.ts:22:3) { code: 'SQLITE_UNKNOWN', rawCode: undefined, [cause]: [ResponseError: SQLite error: no such table: main.compositionSettings] { code: 'SQLITE_UNKNOWN', proto: { message: 'SQLite error: no such table: main.compositionSettings', code: 'SQLITE_UNKNOWN' } } } Node.js v20.12.2 Wondering if anyone could help me troubleshoot this?
1 replies