File: database.dbml
- Copy the new DBML file from (somewhere) to
/docs/backend/database.dbml - Run "Create Schema Files" Script:
npm run drizzle-update-schema.
Infos: createSchemaFiles/readme.md
WHAT: Update a database after the schema in backend project was changed.
- is reading from
/backend/.env.local - is reading drizzle config from
/backend/drizzle.config.js - is writing the migrations to
/backend/database/drizzle/migrations
Info: run from project root
- Create migrations according to schema changes:
npm run drizzle-create-migration-files - Create custom migrations (e.g. for data changes):
a.npm run drizzle-create-migration-files -- --custom
b. Write sql update queries into the newly created sql file in/backend/database/drizzle/migrations
- is reading from
/backend/.env.local - is reading drizzle config from
/backend/drizzle.config.js - is reading the migrations from
/backend/database/drizzle/migrations
Info: for tipcards.io and dev.tipcards.io the migration files are automatically executed in the gitlab pipeline. Just push main or develop branch!
Info: for manual execution run from project root
npm run drizzle-migrateWe commit all migrations into git. Just revert/reset the current file changes!