-
Toon Claes authored
Users can now use `scripts/regenerate-schema` to create a clean `db/structure.sql` for their branch. What the script does: 1. Disable the migrations (move them where Rails would ignore them) 1. Check out out a clean `db/structure.sql` 1. Reset the test database to this schema 1. Enable the migrations again 1. Run the migrations on the test database This recreates `db/structure.sql` with the migrations added in the current branch. There are several methods the script uses to check out the schema file from the target branch: - When `CI_MERGE_REQUEST_TARGET_BRANCH_SHA` is set, it assumes it's running from CI and it will `curl` the file from `CI_PROJECT_URL` because it assumes a shallow clone is in place. - You can set `TARGET`, like `TARGET=stable scripts/regenerate-schema` to set the target branch. In this case `git checkout $TARGET` is used to checkout `db/structure.sql`. - Otherwise `master` is assumed and used to `git checkout`.
35c09c38