CLI
Generate a migration after changing the entity model. Read the SQL diff before applying it, especially when a change removes or renames a field.
yarn db:generate executes mercato db generate, iterating through every enabled module and creating MikroORM migrations when entity metadata changes.
# Using yarn script
yarn db:generate
# Using CLI directly
yarn mercato db generate
The command requires a valid DATABASE_URL pointing to the Postgres database used for diffing.
packages/cli/src/lib/resolver.ts).data/entities.ts or schema.ts) and spins up a temporary MikroORM instance.packages/<module>/src/modules/<module>/migrations. App overrides fall back to src/modules/<module>/migrations._auth) to keep names unique across modules..snapshot-<project>.json) used by MikroORM as the diff baseline for the next generation run.• auth: generated Migration20240214_auth or • directory: no changes.yarn db:generate after modifying entity definitions.yarn db:migrate or yarn mercato db migrate.DATABASE_URL – set it in your shell or .env before running the command.Previous: mercato customer_accounts sync-customer-role-acls · Next: yarn db:greenfield