Scarcer
Scarcer
DTDrizzle Team
Created by A_Dev on 11/28/2023 in #help
Push with schema in separate files
@Darth_Fuzzy The reason is lame. Simply, linters in vs code don't track that implementation as well.
13 replies
DTDrizzle Team
Created by A_Dev on 11/28/2023 in #help
Push with schema in separate files
Basic server side useage:
import { db, schema } from "@database"

const results = await db.select().from(schema.users)
// or
const results = await db.query.users.findMany()
import { db, schema } from "@database"

const results = await db.select().from(schema.users)
// or
const results = await db.query.users.findMany()
The setup docs are a mess, so it took a lot of trial and error
13 replies
DTDrizzle Team
Created by A_Dev on 11/28/2023 in #help
Push with schema in separate files
tsconfig.json
{
...,
"compilerOptions": {
...,
"paths": {
...,
"@database": [
"./src/lib/server/database"
],
}
}
{
...,
"compilerOptions": {
...,
"paths": {
...,
"@database": [
"./src/lib/server/database"
],
}
}
13 replies
DTDrizzle Team
Created by A_Dev on 11/28/2023 in #help
Push with schema in separate files
database/index.ts looks something like this:
import { schema, relations } from "./schema"

const db = drizzle(client, {
schema: {
...schema,
...relations
},
})

export {
db,
schema,
relations,
...
}
import { schema, relations } from "./schema"

const db = drizzle(client, {
schema: {
...schema,
...relations
},
})

export {
db,
schema,
relations,
...
}
13 replies
DTDrizzle Team
Created by A_Dev on 11/28/2023 in #help
Push with schema in separate files
No description
13 replies
DTDrizzle Team
Created by A_Dev on 11/28/2023 in #help
Push with schema in separate files
No description
13 replies
DTDrizzle Team
Created by A_Dev on 11/28/2023 in #help
Push with schema in separate files
@A_Dev I do the same thing
13 replies