ποΈ Database
Extending database schema
Follow the steps below to extend your database schema. All commands can be ran from the top level (project root) directory.
Define schema
Define your Drizzle (opens in a new tab) schema in /packages/api/src/db/schema.ts.
Generate migration
Generate migration files using the bun generate command.
# Generate types & migrations
bun generateRun migrations
Run the schema migration using the bun migrate:local command.
# Migrate local database
bun migrate:local
# Migrate database hosted on Cloudflare D1
bun migrateCreate seed data
Modify the .sql file at /packages/api/seed/seed.sql with your seed data. ChatGPT or faker.js are great tools for generating seed data.
Seed data
Seed the database using bun seed:local command.
# Seed local database
bun seed:local
# Seed database hosted by Cloudflare D1
bun seedTo run these steps on the Cloudflare D1 hosted database, drop the :local suffix.