- To create migration
npx drizzle-kit generate:mysql --out migrations-folder --schema src/lib/db/schema.ts
- Create drizzle.config.json at the root of the project
{
// path to introspect output
"out": "./migrations", // needed only for introspect
// path to schema file (or several schema files)
"schema": "./db",
// you could specify array for several schema files
// "schema": ["./db", "./core-db", "./core/**/*.ts"],
"connectionString": "mysql://root:password@127.0.0.1:3306/my_db"
}
- To push to the db
npx drizzle-kit push:mysql
- DB push is currently in preview and only works for mysql (Planetscale is mysql)
- There is bug in Drizzle ORM with planestcale serverless driver that prevents the sveltekit app from building. This has been fixed in the beta branch so use the beta branch of drizzle ORM Link to discord discussion
npm install drizzle-orm@beta
If you're seeing this, you've probably already done this step. Congrats!
# create a new project in the current directory
npm create svelte@latest
# create a new project in my-app
npm create svelte@latest my-app
Once you've created a project and installed dependencies with npm install
(or pnpm install
or yarn
), start a development server:
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
To create a production version of your app:
npm run build
You can preview the production build with npm run preview
.
To deploy your app, you may need to install an adapter for your target environment.