Create a database migration by modifying the Drizzle schema and generating the migration SQL. Use when adding tables, columns, indexes, or modifying the database structure.
Create a database migration for: $ARGUMENTS
Read the current schema files in backend/src/database/schema/ to understand existing tables and relations
Read backend/drizzle.config.ts to confirm migration output path and dialect settings
Modify or create schema files in backend/src/database/schema/:
snake_case for all column names (Drizzle casing config handles mapping)text("id").primaryKey())createdAt and updatedAt timestampsrelations() from drizzle-ormbackend/src/database/schema/index.tsGenerate migration:
cd backend && bun run db:generate
Review the generated SQL in backend/src/database/migrations/ — verify it matches expectations
Apply the migration (development only):
cd backend && bun run db:migrate
IMPORTANT: Never manually edit migration files after they've been generated. If the migration is wrong, delete it and regenerate.
snake_case, plural (e.g., user_profiles)snake_case (e.g., created_at, user_id)<referenced_table_singular>_id (e.g., user_id)<table>_<column>_idx (e.g., users_email_idx)