The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
chore: improve backend skill (#84017)
Uladzimir Havenchyk2bb755dfb53e
diff --git a/.claude/skills/backend-module-conventions/SKILL.md b/.claude/skills/backend-module-conventions/SKILL.mdindex 212b4a121c4..56ad1a349ae 100644--- a/.claude/skills/backend-module-conventions/SKILL.md+++ b/.claude/skills/backend-module-conventions/SKILL.md@@ -63,8 +63,9 @@ The docstring of `metabase.app-db.value-guard` explains what the guard refuses w`./bin/lint-migrations-file.sh` enforces these rules. Run it after every change.-- Starting with v60, each change is its own file at `resources/migrations/<NNN>/<yyyyMMdd>_<snake_name>.yaml`. `NNN` is the earliest release the change ships in. New work goes in the newest directory. Don't add to `001_update_migrations.yaml`; its footer describes the legacy format.-- Changeset IDs are `v<NN>.<unique suffix>`, where `NN` matches the directory. The suffix can be a timestamp from `(dev/migration-timestamp)` or any unique string. IDs are not ordered within a directory.+- Create the file with `./bin/mage new-migration <NN> <snake_name>` (e.g. `./bin/mage new-migration 65 add_user_table`). It writes `resources/migrations/<NNN>/<yyyyMMdd>_<snake_name>.yaml` with a changeset stub. Fill in the TODOs.+- Starting with v60, each change is its own file. `NNN` is the earliest release the change ships in. New work goes in the newest directory. Don't add to `001_update_migrations.yaml`. Its footer describes the legacy format.+- Changeset IDs are `v<NN>.<suffix>`, where `NN` matches the directory and the suffix is a random 6-char lowercase alphanumeric string (e.g. `v65.m2xncr`). `new-migration` generates one for the first changeset. For extra changesets in the same file, make up a new suffix and grep `resources/migrations` to confirm it is unused. IDs are not ordered within a directory.- Don't edit a shipped changeset. Add a new one. (Liquibase does recompute checksums and some edits are technically harmless, but the line between "cosmetic" and "ran instances now diverge from fresh installs" is easy to misjudge, so just add a new changeset.) Never delete a shipped changeset either: instances keep the row in `DATABASECHANGELOG` forever; removing the id makes Liquibase log "not rolled back" and any replacement that recreates the same object fails with a duplicate-object error. To retire one when you must, add a NEW changeset that does `DELETE FROM DATABASECHANGELOG WHERE id IN (...)` the retired ids. Put it in the same file as the retired changeset when it ships in the same release (`063/20260714_field_fk_target_field_id_fk.yaml::v63.2026-07-22T12:00:00`), or in the current release's file when it retires an older release's changeset (`059_update_migrations.yaml::v59.2026-01-09T11:30:00` retires `v58.2026-01-09T12:00:00`).- To backport, copy the changesets into the older directory with `v<older>` IDs. Guard each copy with `preConditions: onFail: MARK_RAN` plus `not: changeSetExecuted` that points at the newer ID, so databases that already ran it skip it. `resources/migrations/064/20260911_glossary_entity_id.yaml` shows the pattern.- Give every `indexExists`, `primaryKeyExists`, and `uniqueConstraintExists` precondition a `tableName`, and every `foreignKeyConstraintExists` a `foreignKeyTableName`. Without it, Liquibase snapshots the whole schema, which takes seconds per check.