]> granicus.if.org Git - pgm/commitdiff
generate migration scripts within setup
authorNathan Wagner <nw@hydaspes.if.org>
Tue, 5 Oct 2021 12:53:28 +0000 (07:53 -0500)
committerNathan Wagner <nw@hydaspes.if.org>
Tue, 5 Oct 2021 12:53:28 +0000 (07:53 -0500)
setup

diff --git a/setup b/setup
index 205753bdfb773705311e99f88fa989f7b2524837..154110b4f38dfab97fdbea2826909ed0f4b6a843 100755 (executable)
--- a/setup
+++ b/setup
@@ -11,6 +11,8 @@ legacyfile=/usr/pgsql-9.5_9.5.20/share/contrib/postgis-2.5/legacy.sql
 legacyfile=/usr/pgsql-11/share/contrib/postgis-2.5/legacy.sql
 
 if [ "$what" = 'source' ]; then
+       psql -Aqt service=source -f scripts/gen_migration_id_script.sql > scripts/add_source_migration_id.sql
+       psql -Aqt service=source -f scripts/add_source_migration_id.sql
        {
        cat <<-EOS
        \set VERBOSITY 'terse'
@@ -43,6 +45,8 @@ elif [ "$what" = 'target' ]; then
 
 # must setup the schema on the target, the disable_target_triggers() function
 # uses the posting table to figure out what tables to operate on
+       psql -Aqt service=target -f scripts/gen_migration_id_script.sql > scripts/add_target_migration_id.sql
+       psql -Aqt service=target -f scripts/add_target_migration_id.sql
        {
        cat <<-EOS
        \set VERBOSITY 'terse'
@@ -52,7 +56,7 @@ elif [ "$what" = 'target' ]; then
        set search_path to migration;
        set client_min_messages to notice;
 
-       select add_schema_migration_ids(exclude := ARRAY['junk', 'archive'], initqueue := false);
+       -- select add_schema_migration_ids(exclude := ARRAY['junk', 'archive'], initqueue := false);
        select setup_schema(exclude := ARRAY['junk', 'archive'], initqueue := false);
        select disable_target_triggers();
        EOS