_chaii
_chaii
DTDrizzle Team
Created by _chaii on 8/13/2024 in #help
Set up drizzle config db url
Dependencies: "drizzle-orm": "^0.31.2" "drizzle-kit": "^0.22.7" "@planetscale/database": "^1.18.0" Setting up the configuration for this database has not been as straight forward as expected. I have a new db called findasetter_v2 under findasetter planet scale organisation. Drizzle config looks like:
import { type Config } from 'drizzle-kit'

import { env } from '~/env'

export default {
schema: './src/server/db/schema.ts',
dialect: 'mysql',
dbCredentials: {
url: env.DATABASE_URL,
},
tablesFilter: ['findasetter_v2_*'],
} satisfies Config`
import { type Config } from 'drizzle-kit'

import { env } from '~/env'

export default {
schema: './src/server/db/schema.ts',
dialect: 'mysql',
dbCredentials: {
url: env.DATABASE_URL,
},
tablesFilter: ['findasetter_v2_*'],
} satisfies Config`
db set up - I've tried two approaches:
import { Client } from '@planetscale/database'
import { drizzle } from 'drizzle-orm/planetscale-serverless'

const client = new Client({
host: process.env['DATABASE_HOST'],
username: process.env['DATABASE_USERNAME'],
password: process.env['DATABASE_PASSWORD'],
})

export const db = drizzle(client)
import { Client } from '@planetscale/database'
import { drizzle } from 'drizzle-orm/planetscale-serverless'

const client = new Client({
host: process.env['DATABASE_HOST'],
username: process.env['DATABASE_USERNAME'],
password: process.env['DATABASE_PASSWORD'],
})

export const db = drizzle(client)
DB url looks like DATABASE_URL='mysql://USERNAME:[email protected]/findasetter?ssl={"rejectUnauthorized":true}' Now when I run any drizzle command i.e. studio or push, there is an error: Error: VT05003: unknown database 'findasetter' in vschema Any ideas on how to fix this?
2 replies