From aeb1fe88629f53f3897af3aedb31960e697e0818 Mon Sep 17 00:00:00 2001 From: Eric Meyer Date: Mon, 6 Nov 2017 13:11:56 -0600 Subject: [PATCH] Nest migrations under db directory --- Gododir/main.go | 8 ++++---- .../migrations}/1508943247_create_blocks_table.down.sql | 0 .../migrations}/1508943247_create_blocks_table.up.sql | 0 .../migrations}/1508965325_add_columns_to_blocks.down.sql | 0 .../migrations}/1508965325_add_columns_to_blocks.up.sql | 0 .../1509119369_initial_transaction_table.down.sql | 0 .../1509119369_initial_transaction_table.up.sql | 0 .../1509391861_add_primary_key_to_blocks.down.sql | 0 .../1509391861_add_primary_key_to_blocks.up.sql | 0 .../1509460207_add_block_id_to_transactions.down.sql | 0 .../1509460207_add_block_id_to_transactions.up.sql | 0 .../migrations}/1509484288_add_block_index.down.sql | 0 .../migrations}/1509484288_add_block_index.up.sql | 0 .../migrations}/1509633481_add_blocks_columns.down.sql | 0 .../migrations}/1509633481_add_blocks_columns.up.sql | 0 {migrations => db}/schema.sql | 0 16 files changed, 4 insertions(+), 4 deletions(-) rename {migrations => db/migrations}/1508943247_create_blocks_table.down.sql (100%) rename {migrations => db/migrations}/1508943247_create_blocks_table.up.sql (100%) rename {migrations => db/migrations}/1508965325_add_columns_to_blocks.down.sql (100%) rename {migrations => db/migrations}/1508965325_add_columns_to_blocks.up.sql (100%) rename {migrations => db/migrations}/1509119369_initial_transaction_table.down.sql (100%) rename {migrations => db/migrations}/1509119369_initial_transaction_table.up.sql (100%) rename {migrations => db/migrations}/1509391861_add_primary_key_to_blocks.down.sql (100%) rename {migrations => db/migrations}/1509391861_add_primary_key_to_blocks.up.sql (100%) rename {migrations => db/migrations}/1509460207_add_block_id_to_transactions.down.sql (100%) rename {migrations => db/migrations}/1509460207_add_block_id_to_transactions.up.sql (100%) rename {migrations => db/migrations}/1509484288_add_block_index.down.sql (100%) rename {migrations => db/migrations}/1509484288_add_block_index.up.sql (100%) rename {migrations => db/migrations}/1509633481_add_blocks_columns.down.sql (100%) rename {migrations => db/migrations}/1509633481_add_blocks_columns.up.sql (100%) rename {migrations => db}/schema.sql (100%) diff --git a/Gododir/main.go b/Gododir/main.go index b0f80047..fece563e 100644 --- a/Gododir/main.go +++ b/Gododir/main.go @@ -29,8 +29,8 @@ func tasks(p *do.Project) { environment := parseEnvironment(context) cfg := config.NewConfig(environment) connectString := config.DbConnectionString(cfg.Database) - migrate := fmt.Sprintf("migrate -database '%s' -path ./migrations up", connectString) - dumpSchema := fmt.Sprintf("pg_dump -O -s %s > migrations/schema.sql", cfg.Database.Name) + migrate := fmt.Sprintf("migrate -database '%s' -path ./db/migrations up", connectString) + dumpSchema := fmt.Sprintf("pg_dump -O -s %s > ./db/schema.sql", cfg.Database.Name) context.Bash(migrate) context.Bash(dumpSchema) }) @@ -39,8 +39,8 @@ func tasks(p *do.Project) { environment := parseEnvironment(context) cfg := config.NewConfig(environment) connectString := config.DbConnectionString(cfg.Database) - migrate := fmt.Sprintf("migrate -database '%s' -path ./migrations down 1", connectString) - dumpSchema := fmt.Sprintf("pg_dump -O -s %s > migrations/schema.sql", cfg.Database.Name) + migrate := fmt.Sprintf("migrate -database '%s' -path ./db/migrations down 1", connectString) + dumpSchema := fmt.Sprintf("pg_dump -O -s %s > ./db/schema.sql", cfg.Database.Name) context.Bash(migrate) context.Bash(dumpSchema) }) diff --git a/migrations/1508943247_create_blocks_table.down.sql b/db/migrations/1508943247_create_blocks_table.down.sql similarity index 100% rename from migrations/1508943247_create_blocks_table.down.sql rename to db/migrations/1508943247_create_blocks_table.down.sql diff --git a/migrations/1508943247_create_blocks_table.up.sql b/db/migrations/1508943247_create_blocks_table.up.sql similarity index 100% rename from migrations/1508943247_create_blocks_table.up.sql rename to db/migrations/1508943247_create_blocks_table.up.sql diff --git a/migrations/1508965325_add_columns_to_blocks.down.sql b/db/migrations/1508965325_add_columns_to_blocks.down.sql similarity index 100% rename from migrations/1508965325_add_columns_to_blocks.down.sql rename to db/migrations/1508965325_add_columns_to_blocks.down.sql diff --git a/migrations/1508965325_add_columns_to_blocks.up.sql b/db/migrations/1508965325_add_columns_to_blocks.up.sql similarity index 100% rename from migrations/1508965325_add_columns_to_blocks.up.sql rename to db/migrations/1508965325_add_columns_to_blocks.up.sql diff --git a/migrations/1509119369_initial_transaction_table.down.sql b/db/migrations/1509119369_initial_transaction_table.down.sql similarity index 100% rename from migrations/1509119369_initial_transaction_table.down.sql rename to db/migrations/1509119369_initial_transaction_table.down.sql diff --git a/migrations/1509119369_initial_transaction_table.up.sql b/db/migrations/1509119369_initial_transaction_table.up.sql similarity index 100% rename from migrations/1509119369_initial_transaction_table.up.sql rename to db/migrations/1509119369_initial_transaction_table.up.sql diff --git a/migrations/1509391861_add_primary_key_to_blocks.down.sql b/db/migrations/1509391861_add_primary_key_to_blocks.down.sql similarity index 100% rename from migrations/1509391861_add_primary_key_to_blocks.down.sql rename to db/migrations/1509391861_add_primary_key_to_blocks.down.sql diff --git a/migrations/1509391861_add_primary_key_to_blocks.up.sql b/db/migrations/1509391861_add_primary_key_to_blocks.up.sql similarity index 100% rename from migrations/1509391861_add_primary_key_to_blocks.up.sql rename to db/migrations/1509391861_add_primary_key_to_blocks.up.sql diff --git a/migrations/1509460207_add_block_id_to_transactions.down.sql b/db/migrations/1509460207_add_block_id_to_transactions.down.sql similarity index 100% rename from migrations/1509460207_add_block_id_to_transactions.down.sql rename to db/migrations/1509460207_add_block_id_to_transactions.down.sql diff --git a/migrations/1509460207_add_block_id_to_transactions.up.sql b/db/migrations/1509460207_add_block_id_to_transactions.up.sql similarity index 100% rename from migrations/1509460207_add_block_id_to_transactions.up.sql rename to db/migrations/1509460207_add_block_id_to_transactions.up.sql diff --git a/migrations/1509484288_add_block_index.down.sql b/db/migrations/1509484288_add_block_index.down.sql similarity index 100% rename from migrations/1509484288_add_block_index.down.sql rename to db/migrations/1509484288_add_block_index.down.sql diff --git a/migrations/1509484288_add_block_index.up.sql b/db/migrations/1509484288_add_block_index.up.sql similarity index 100% rename from migrations/1509484288_add_block_index.up.sql rename to db/migrations/1509484288_add_block_index.up.sql diff --git a/migrations/1509633481_add_blocks_columns.down.sql b/db/migrations/1509633481_add_blocks_columns.down.sql similarity index 100% rename from migrations/1509633481_add_blocks_columns.down.sql rename to db/migrations/1509633481_add_blocks_columns.down.sql diff --git a/migrations/1509633481_add_blocks_columns.up.sql b/db/migrations/1509633481_add_blocks_columns.up.sql similarity index 100% rename from migrations/1509633481_add_blocks_columns.up.sql rename to db/migrations/1509633481_add_blocks_columns.up.sql diff --git a/migrations/schema.sql b/db/schema.sql similarity index 100% rename from migrations/schema.sql rename to db/schema.sql