TJ
TJ
Explore posts from servers
DTDrizzle Team
Created by seckraken on 6/14/2024 in #help
Create a view with Drizzle
In the case like this we will have a schema.js to create tables and another SQL file to create the views. I'm wondering how we store and run this SQL file?
8 replies
DTDrizzle Team
Created by TJ on 6/16/2024 in #help
Conflicting peer dependency of [email protected] when installing [email protected] in Next.js 14.2.4
@Flexi I installed drizzle-orm with --force like what @A Dapper Raccoon explained.
6 replies
DTDrizzle Team
Created by TJ on 5/8/2024 in #help
How to share Drizzle schema in multiple projects?
Thanks, @JipSterk So this how I share the schema in monorepo: I have created two packages, db to store the schema and app to import the schema:
/
+--db
| +- schema.js
| +- index.js
| +- drizzle.config.js
|
+--app
| +- app.js
/
+--db
| +- schema.js
| +- index.js
| +- drizzle.config.js
|
+--app
| +- app.js
Note that the drizzle.config.js is created in db to generate the migration using drizzle-kit. Then the schema looks like this,
// schema.js
export const invoices = pgTable("users", { ...})
// schema.js
export const invoices = pgTable("users", { ...})
and the package main script to export the schema,
// index.js
export * from "./schema.js";
// index.js
export * from "./schema.js";
then I import the schema in the app
// app.js
import * as schema from '@app/db/schema.js'

const options = { ... }

const db = drizzle(postgres(options), { logger: true, schema })
// app.js
import * as schema from '@app/db/schema.js'

const options = { ... }

const db = drizzle(postgres(options), { logger: true, schema })
3 replies
DTDrizzle Team
Created by TJ on 4/24/2024 in #help
Access MariaDB in Drizzle using node-mysql2?
Uh ... simply because of the compatibility issues? I think we just have to give up of MariaDB if we want to use Drizzle.
4 replies