Comments (3)
Can you try using planetscale mysql. I heard on twitter that, drizzle orm doesn't work quite well with local mysql if planetscale sql is used.
from shadcn-table.
Tested it locally ( OSX with DBngin ) with "mysql2": "3.7.1"
.
Works without any issues.
// drizzle.config.ts
import { type Config } from "drizzle-kit"
import { env } from "@/env.mjs"
const uri = [
"mysql://",
env.DB_USERNAME,
":",
env.DB_PASSWORD,
"@",
env.DB_HOST,
":3306/",
env.DB_NAME,
].join("")
export default {
schema: "./src/db/schema.ts",
driver: "mysql2",
out: "./drizzle",
dbCredentials: { uri },
tablesFilter: ["shadcn-table_*"],
} satisfies Config
// src/env.mjs
import { createEnv } from "@t3-oss/env-nextjs"
import { z } from "zod"
export const env = createEnv({
server: {
NODE_ENV: z
.enum(["development", "test", "production"])
.default("development"),
DB_USERNAME: z.string(),
DB_HOST: z.string(),
DB_NAME: z.string(),
DB_PASSWORD: z.string(),
},
client: {},
runtimeEnv: {
NODE_ENV: process.env.NODE_ENV,
DB_NAME: process.env.DB_NAME,
DB_HOST: process.env.DB_HOST,
DB_USERNAME: process.env.DB_USERNAME,
DB_PASSWORD: process.env.DB_PASSWORD
},
skipValidation: !!process.env.SKIP_ENV_VALIDATION,
emptyStringAsUndefined: true,
})
// src/db/index.ts
import { drizzle } from "drizzle-orm/mysql2"
import mysql from "mysql2/promise"
import { env } from "@/env.mjs"
import * as schema from "./schema"
const connection = await mysql.createConnection({
host: env.DB_HOST,
user: env.DB_USERNAME,
password: env.DB_PASSWORD,
database: env.DB_NAME,
})
export const db = drizzle(connection, { schema, mode: "default" })
from shadcn-table.
The project is using neon (via postgressql) now.
So closing the issue.
from shadcn-table.
Related Issues (20)
- Command block only responsive to keyboard HOT 3
- Sticky Header HOT 2
- Requesting Date Range filter with shadcn calender HOT 4
- how to use Global filter HOT 3
- what params to have full page display without pagination and scroll HOT 1
- [bug]: enableHiding and enableSorting not correctly reflected inside data-table-column-header HOT 1
- [feat]: export to csv HOT 6
- [feat]: filter boolean HOT 6
- [bug]: data in the update-sheet was incorrect after creating a new item
- [Bug] useDataTable: Allow schema parameter to override default createdAt sort HOT 1
- [bug]: Advanced Filter doesn't appear to work in demo HOT 2
- [feat]: Relations / references HOT 1
- [feat]: Grouping Support
- [bug]: Date range isn't persisted across reloads HOT 1
- [feat]: Determine per_page on container/viewport on load
- [bug]: Recent Date-Range fix is displaying the previous day instead of selected url date HOT 1
- [bug]: https://table.sadmn.com/ 404 HOT 1
- [bug]: page empty HOT 1
- pageCount: number vs defaultPerPage?: number; HOT 2
- [bug]: Blank page HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shadcn-table.