mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
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:
parent
6254c64ab5
commit
acd9a60af3
2 changed files with 17 additions and 9 deletions
18
db/README.md
18
db/README.md
|
@ -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
|
following the existing scripts in that folder. Note the double underscore in
|
||||||
the naming pattern.
|
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:
|
implemented in the `nom_build` script that does the following:
|
||||||
|
|
||||||
- Runs the `:db:test` task from the Gradle root project. The SchemaTest
|
- Runs the `:db:test` task from the Gradle root project. The SchemaTest
|
||||||
will fail because the new schema does not match the golden file.
|
will fail because the new schema does not match the golden file.
|
||||||
|
|
||||||
- Copies `db/build/resources/test/testcontainer/mount/dump.txt` to the golden
|
- Copies `db/build/resources/test/testcontainer/mount/dump.txt` to the
|
||||||
file `db/src/main/resources/sql/schema/nomulus.golden.sql`.
|
golden file `db/src/main/resources/sql/schema/nomulus.golden.sql`.
|
||||||
|
|
||||||
- Re-runs the `:db:test` task. This time all tests should pass.
|
- 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
|
You'll want to have a look at the diffs in the golden schema to verify that
|
||||||
that all changes are intentional.
|
all changes are intentional.
|
||||||
|
|
||||||
Relevant files (under db/src/main/resources/sql/schema/):
|
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}
|
./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
|
#### Glass Breaking
|
||||||
|
|
||||||
If you need to deploy a schema off-cycle, try making a release first, then
|
If you need to deploy a schema off-cycle, try making a release first, then
|
||||||
|
|
|
@ -29,8 +29,8 @@ ext {
|
||||||
def dbServer = findProperty(dbServerProperty).toString().toLowerCase()
|
def dbServer = findProperty(dbServerProperty).toString().toLowerCase()
|
||||||
def dbName = findProperty(dbNameProperty)
|
def dbName = findProperty(dbNameProperty)
|
||||||
|
|
||||||
isCloudSql = {
|
isRestricted = {
|
||||||
return allDbEnv.contains(dbServer)
|
return restrictedDbEnv.contains(dbServer)
|
||||||
}
|
}
|
||||||
|
|
||||||
getAccessInfoByHostPort = { hostAndPort ->
|
getAccessInfoByHostPort = { hostAndPort ->
|
||||||
|
@ -169,8 +169,8 @@ dependencies {
|
||||||
flywayInfo.dependsOn('buildNeeded')
|
flywayInfo.dependsOn('buildNeeded')
|
||||||
flywayValidate.dependsOn('buildNeeded')
|
flywayValidate.dependsOn('buildNeeded')
|
||||||
|
|
||||||
if (ext.isCloudSql()) {
|
if (ext.isRestricted()) {
|
||||||
// Disable dangerous Flyway tasks. Only allow info and validate.
|
// Disable dangerous Flyway tasks in sandbox and production. Only allow info and validate.
|
||||||
tasks.findAll { task -> task.group.equals('Flyway')}.each {
|
tasks.findAll { task -> task.group.equals('Flyway')}.each {
|
||||||
if (it.name == 'flywayMigrate') {
|
if (it.name == 'flywayMigrate') {
|
||||||
it.doFirst {
|
it.doFirst {
|
||||||
|
|
Loading…
Add table
Reference in a new issue