* Regenerate schema using tools command Rerun GenerateSqlSchemaCommand to pick up RegistryLock and naming strategy change. Also updated a new license term which seems to just pop up. |
||
---|---|---|
.. | ||
gradle/dependency-locks | ||
src/main/resources/sql | ||
build.gradle | ||
README.md |
Summary
This project contains Nomulus's Cloud SQL schema and schema deployment utilities.
Schema Creation DDL
Currently we use Flywaydb for schema deployment. Versioned migration scripts are organized in the src/main/resources/sql/flyway folder. Scripts must follow the V{id}__{description text}.sql naming pattern (Note the double underscore).
The 'nomulus.golden.sql' file in src/main/resources/sql/schema folder is mainly informational. It is generated by Hibernate and should not be reformatted. We will use it in validation tests later.
Non-production Schema Push
To manage schema in a non-production environment, use the 'flywayMigration' task. You will need Cloud SDK and login once.
# One time login
gcloud auth login
# Deploy the current schema to alpha
gradlew :db:flywayMigrate -PdbServer=alpha
# Delete the entire schema in alpha
gradlew :db:flywayClean -PdbServer=alpha
The flywayMigrate task is idempotent. Repeated runs will not introduce problems.
The Flyway tasks may also be used to deploy to local instances, e.g, your own test instance. E.g.,
# Deploy to a local instance at standard port as the super user.
gradlew :db:flywayMigrate -PdbServer=192.168.9.2 -PdbPassword=domain-registry
# Full specification of all parameters
gradlew :db:flywayMigrate -PdbServer=192.168.9.2:5432 -PdbUser=postgres \
-PdbPassword=domain-registry
Production Schema Deployment
Schema deployment to production and sandbox is under development.