mirror of
https://github.com/google/nomulus
synced 2026-07-31 12:32:50 +00:00
Create a flyway index file and verify correctness (#819)
* Create a flyway index file and verify correctness Create an index file (flyway.txt) containing the names of all of the flyway files and verify that it is ordered and in sync with the actual contents of the flyway directory. Also provide a target (generateFlywayIndex) to automatically generate it. The purpose of flyway.txt is to cause a merge conflict in the event that two different developers add a flyway file with the same sequence number, an event which has occurred multiple times.
This commit is contained in:
@@ -61,6 +61,11 @@ Below are the steps to submit a schema change:
|
||||
You'll want to have a look at the diffs in the golden schema to verify that
|
||||
all changes are intentional.
|
||||
|
||||
5. Run ./nom_build :db:generateFlywayIndex to regenerate the Flyway index.
|
||||
This is a file listing all of the current Flyway files. Its purpose is to
|
||||
produce a merge conflict when more than one person adds a Flyway file with
|
||||
the same sequence number.
|
||||
|
||||
Relevant files (under db/src/main/resources/sql/schema/):
|
||||
|
||||
* nomulus.golden.sql is the schema dump (pg_dump for postgres) of the final
|
||||
|
||||
@@ -170,6 +170,28 @@ dependencies {
|
||||
testCompile project(path: ':common', configuration: 'testing')
|
||||
}
|
||||
|
||||
task generateFlywayIndex {
|
||||
def flywayBase = "$projectDir/src/main/resources/sql/flyway"
|
||||
def filenamePattern = /V(\d+)__.*\.sql/
|
||||
|
||||
def getSeqNum = { file ->
|
||||
def match = file.getName() =~ filenamePattern
|
||||
if (match.size() != 1) {
|
||||
throw new IllegalArgumentException("Bad Flyway filename: $file")
|
||||
}
|
||||
return match[0][1] as int
|
||||
}
|
||||
|
||||
doLast {
|
||||
def files = new File(flywayBase).listFiles()
|
||||
def indexFile = new File("${flywayBase}.txt")
|
||||
indexFile.write ''
|
||||
for (def file : files.sort{a, b -> getSeqNum(a) <=> getSeqNum(b)}) {
|
||||
indexFile << "${file.name}\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flywayInfo.dependsOn('buildNeeded')
|
||||
flywayValidate.dependsOn('buildNeeded')
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
V1__create_claims_list_and_entry.sql
|
||||
V2__create_premium_list_and_entry.sql
|
||||
V3__create_registry_lock.sql
|
||||
V4__registry_lock_add_index_on_verification_code.sql
|
||||
V5__update_premium_list.sql
|
||||
V6__premium_list_bloom_filter.sql
|
||||
V7__update_claims_list.sql
|
||||
V8__registry_lock_registrar_index.sql
|
||||
V9__premium_list_currency_type.sql
|
||||
V10__create_reserved_list_and_entry.sql
|
||||
V11__premium_entry_reorder_column.sql
|
||||
V12__create_cursor.sql
|
||||
V13__refactor_registry_lock.sql
|
||||
V14__load_extension_for_hstore.sql
|
||||
V15__add_epp_resources.sql
|
||||
V16__create_registrar.sql
|
||||
V17__create_registrar_poc.sql
|
||||
V18__create_lock.sql
|
||||
V19__add_registry_relock_reference.sql
|
||||
V20__add_relock_duration.sql
|
||||
V21__add_registry_lock_email_to_poc.sql
|
||||
V22__update_ns_hosts.sql
|
||||
V23__create_contact.sql
|
||||
V24__domain_base_contacts.sql
|
||||
V25__rename_vkey_fields.sql
|
||||
V26__create_billing_event.sql
|
||||
V27__create_pollmessage.sql
|
||||
V28__superordinate_domain_vkey.sql
|
||||
V29__add_columns_for_transfer_data.sql
|
||||
V30__inet_address_converter.sql
|
||||
V31__client_id_to_registrar_id.sql
|
||||
V32__drop_unused_transafer_data_columns_in_contact.sql
|
||||
V33__create_host_history.sql
|
||||
V34__rename_fully_qualified_names.sql
|
||||
V35__rename_allow_list.sql
|
||||
V36__create_safebrowsing_threats.sql
|
||||
V37__update_spec11threatmatch.sql
|
||||
V38__create_contact_history.sql
|
||||
V39__add_updatetime_column.sql
|
||||
V40__spec11threatmatch_remove_registrar_foreign_key.sql
|
||||
V41__add_columns_to_domain.sql
|
||||
V42__add_txn_table.sql
|
||||
V43__update_relock_duration_type.sql
|
||||
V44__create_domain_history.sql
|
||||
V45__add_grace_period_table.sql
|
||||
V46__Contact_contactId_index_to_non_unique.sql
|
||||
V47__remove_spec11_domain_foreign_key.sql
|
||||
V48__domain_add_autorenew_end_time_column.sql
|
||||
V49__create_allocation_token.sql
|
||||
V50__use_composite_key_for_registrar_poc.sql
|
||||
V51__use_composite_primary_key_for_domain_history_table.sql
|
||||
V52__update_billing_constraint.sql
|
||||
V53__add_temp_history_id_sequence.sql
|
||||
V54__add_tld_table.sql
|
||||
V55__domain_history_fields.sql
|
||||
V56__rename_host_table.sql
|
||||
V57__history_null_content.sql
|
||||
V58__drop_default_value_and_sequences_for_billing_event.sql
|
||||
Reference in New Issue
Block a user