Allow schema push in alpha and crash (#771)

* Allow schema push in alpha and crash

This allows unsubmitted changes to be tested in alpha and
crash.

Also updated the README file and reformatted with the internal
mdformat tool.
This commit is contained in:
Weimin Yu 2020-08-19 00:05:57 -04:00 committed by GitHub
parent 6254c64ab5
commit acd9a60af3
2 changed files with 17 additions and 9 deletions

View file

@ -47,18 +47,19 @@ Below are the steps to submit a schema change:
following the existing scripts in that folder. Note the double underscore in
the naming pattern.
4. Run `./nom_build :nom:generate_golden_file`. This is a pseudo-task
4. Run `./nom_build :nom:generate_golden_file`. This is a pseudo-task
implemented in the `nom_build` script that does the following:
- Runs the `:db:test` task from the Gradle root project. The SchemaTest
will fail because the new schema does not match the golden file.
- Copies `db/build/resources/test/testcontainer/mount/dump.txt` to the golden
file `db/src/main/resources/sql/schema/nomulus.golden.sql`.
- Copies `db/build/resources/test/testcontainer/mount/dump.txt` to the
golden file `db/src/main/resources/sql/schema/nomulus.golden.sql`.
- Re-runs the `:db:test` task. This time all tests should pass.
You'll want to have a look at the diffs in the golden schema to verify
that all changes are intentional.
You'll want to have a look at the diffs in the golden schema to verify that
all changes are intentional.
Relevant files (under db/src/main/resources/sql/schema/):
@ -102,6 +103,13 @@ gcloud builds submit --config=release/cloudbuild-schema-deploy.yaml \
./nom_build :db:flywayInfo --dbServer=${SQL_ENV}
```
To test unsubmitted schema changes in the alpha or crash environments, use the
following command to deploy the local schema,
```shell
./nom_build :db:flywayMigrate --dbServer=[alpha|crash] --environment=[alpha|crash]
```
#### Glass Breaking
If you need to deploy a schema off-cycle, try making a release first, then

View file

@ -29,8 +29,8 @@ ext {
def dbServer = findProperty(dbServerProperty).toString().toLowerCase()
def dbName = findProperty(dbNameProperty)
isCloudSql = {
return allDbEnv.contains(dbServer)
isRestricted = {
return restrictedDbEnv.contains(dbServer)
}
getAccessInfoByHostPort = { hostAndPort ->
@ -169,8 +169,8 @@ dependencies {
flywayInfo.dependsOn('buildNeeded')
flywayValidate.dependsOn('buildNeeded')
if (ext.isCloudSql()) {
// Disable dangerous Flyway tasks. Only allow info and validate.
if (ext.isRestricted()) {
// Disable dangerous Flyway tasks in sandbox and production. Only allow info and validate.
tasks.findAll { task -> task.group.equals('Flyway')}.each {
if (it.name == 'flywayMigrate') {
it.doFirst {