Closed nevthereal closed 5 months ago
Can you share the full error? It should be fully compatible with the SQLite Drizzle
This is the code:
import { DrizzleSQLiteAdapter } from '@lucia-auth/adapter-drizzle';
import { sessionTable, userTable } from '../db/schema';
export const adapter = new DrizzleSQLiteAdapter(client, sessionTable, userTable);
and this is the error:
Argument of type 'LibSQLDatabase<typeof import("/Users/nevillebrem/Developer/Projects/barmates-store/src/lib/server/db/schema")>' is not assignable to parameter of type 'BaseSQLiteDatabase<any, any, Record<string, never>, ExtractTablesWithRelations<Record<string, never>>>'.
The types of '_.schema' are incompatible between these types.
Type 'ExtractTablesWithRelations<typeof import("/Users/nevillebrem/Developer/Projects/barmates-store/src/lib/server/db/schema")> | undefined' is not assignable to type 'ExtractTablesWithRelations<Record<string, never>> | undefined'.
Type 'ExtractTablesWithRelations<typeof import("/Users/nevillebrem/Developer/Projects/barmates-store/src/lib/server/db/schema")>' is not assignable to type 'ExtractTablesWithRelations<Record<string, never>>'.
Property 'userTable' is incompatible with index signature.
Type '{ tsName: "userTable"; dbName: "users"; columns: { id: SQLiteColumn<{ name: "id"; tableName: "users"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; enumValues: [...]; baseColumn: never; }, object>; ... 5 more ...; stripeId: SQLiteColumn<...>; }; re...' is not assignable to type '{ tsName: string; dbName: never; columns: never; relations: Record<string, Relation<string>>; primaryKey: AnyColumn[]; }'.
Types of property 'dbName' are incompatible.
Type 'string' is not assignable to type 'never'.
Ah, thanks - I believe this is just a type issue when you initialize Drizzle ORM with a schema. It should work fine if you ignore the TS error, and if it does, can you open a new bug report for the type issue?
Yeah I believe this is related https://github.com/lucia-auth/lucia/pull/1426
Ok, thank you!
Package
@lucia-auth/adapter-drizzle
Description
So if I currently try to use libsql (Turso) with the Drizzle Adapter in my SvelteKit app, that doesn't work. Instead I need to use the libsql adapter, which throws a dependency conflict. In the docs the Drizzle Adapter is showcased with bettersqlite-3 but is there a way to implement Turso too, without the libsql adapter?