@@ -205,16 +205,16 @@ export default defineConfig({
|
||||
|
||||
```bash
|
||||
# Generate migration SQL from schema changes
|
||||
npx drizzle-kit generate
|
||||
bunx --bun drizzle-kit generate
|
||||
|
||||
# Push schema directly to database (development only — skips migration files)
|
||||
npx drizzle-kit push
|
||||
bunx --bun drizzle-kit push
|
||||
|
||||
# Run pending migrations (production)
|
||||
npx drizzle-kit migrate
|
||||
bunx --bun drizzle-kit migrate
|
||||
|
||||
# Open Drizzle Studio (GUI database browser)
|
||||
npx drizzle-kit studio
|
||||
bunx --bun drizzle-kit studio
|
||||
```
|
||||
|
||||
## Database Client Setup
|
||||
@@ -357,7 +357,7 @@ export async function createUser(formData: FormData) {
|
||||
**Solution:** Pass all schema objects (including relations) to `drizzle()`: `drizzle(client, { schema })`
|
||||
|
||||
**Problem:** Migration conflicts after schema changes
|
||||
**Solution:** Run `npx drizzle-kit generate` to create a new migration, then `npx drizzle-kit migrate`
|
||||
**Solution:** Run `bunx --bun drizzle-kit generate` to create a new migration, then `bunx --bun drizzle-kit migrate`
|
||||
|
||||
**Problem:** Type errors on `.returning()` with MySQL
|
||||
**Solution:** MySQL does not support `RETURNING`. Use `.execute()` and read `insertId` from the result instead.
|
||||
|
||||
Reference in New Issue
Block a user