* Use Flyway to deploy SQL schema to non-prod Added Gradle tasks to deploy and drop schema in alpha using Flyway. Updated ClaimsList.java so that Hibernate-generated schema would use the right types. Using 'varchar(255)' instead of 'text' for string columns for now. We will need to investigate how to force Hibernate to use the desired types in all cases. * Use Flyway to deploy SQL schema to non-prod Added Gradle tasks to deploy and drop schema in alpha using Flyway. Updated ClaimsList.java so that Hibernate-generated schema would use the right types. Using 'varchar(255)' instead of 'text' for string columns for now. We will need to investigate how to force Hibernate to use the desired types in all cases.Added Gradle tasks to deploy and drop schema in alpha using Flyway. Updated ClaimsList.java so that Hibernate-generated schema would use the right types. Using 'varchar(255)' instead of 'text' for string columns for now. We will need to investigate how to force Hibernate to use the desired types in all cases. * Use Flyway to deploy SQL schema to non-prod Added Gradle tasks to deploy and drop schema in alpha using Flyway. Corrected the type of ClaimsEntry's revision_id column. It should be plain int8, not bigserial. Make GenerateSqlSchemaCommand use a custom dialect that converts all varchar type to 'text' and timestamp to 'timestamptz'. * Use Flyway to deploy SQL schema to non-prod Added Gradle tasks to deploy and drop schema in alpha using Flyway. Use a custome dialect in GenerateSqlSchemaCommand to convert varchar type to 'text' and timestamp to 'timestamptz'. Corrected ClaimsEntry's revision_id column type to int8. This column tracks parent table's primary key and should not be bigserial. * Use Flyway to deploy SQL schema to non-prod Added Gradle tasks to deploy and drop schema in alpha using Flyway. Use a custome dialect in GenerateSqlSchemaCommand to convert varchar type to 'text' and timestamp to 'timestamptz'. Corrected ClaimsEntry's revision_id column type to int8. This column tracks parent table's primary key and should not be bigserial. * Use Flyway to deploy SQL schema to non-prod Added Gradle tasks to deploy and drop schema in alpha using Flyway. Use a custome dialect in GenerateSqlSchemaCommand to convert varchar type to 'text' and timestamp to 'timestamptz'. Corrected ClaimsEntry's revision_id column type to int8. This column tracks parent table's primary key and should not be bigserial. |
||
---|---|---|
.. | ||
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.