sveltejs / cli

The Svelte CLI
MIT License
256 stars 9 forks source link

Support for Turso Dialect #304

Open danniscript opened 3 days ago

danniscript commented 3 days ago

Add dialect: 'turso' in drizzle.config.ts files 👍

ref: https://orm.drizzle.team/docs/tutorials/drizzle-with-turso

note: this is only relevant for the latest version of drizzle-kit

rakis10 commented 1 day ago

@danniscript hello could please provide your drizzle.config.ts file?

i keep getting error: Type '"turso"' is not assignable to type '"postgresql" | "mysql" | "sqlite"'.ts(2322) index.d.mts(113, 5): The expected type comes from property 'dialect' which is declared here on type 'Config'

danniscript commented 1 day ago

Using drizzle-kit": "^0.28.1"

import { defineConfig } from 'drizzle-kit'

if (!process.env.DATABASE_URL) throw new Error('DATABASE_URL is not set')

export default defineConfig({
    out: './migrations',
    schema: './src/lib/server/schema',

    dbCredentials: {
        url: process.env.DATABASE_URL,
        authToken: process.env.DATABASE_AUTH_TOKEN
    },

    verbose: true,
    strict: true,
    dialect: 'turso'
})
rakis10 commented 1 day ago

that could be issue cli currently generates package.json

    "drizzle-kit": "^0.23.0",

which possibly doesnt satisfy dialect : turso

manuel3108 commented 1 day ago

Updating the dependencies used while scaffolding is on our priority list!

rakis10 commented 1 day ago

this is weird: at https://orm.drizzle.team/docs/latest-releases latest drizzle-kit is 0.23.2

also i need to upgrade drizzle-orm to 0.36.3

and also install @libsql/client. I am not sure if it was in deps before.

but now it works