withtest ./mg-schema-update -q apply $wantupdates
+ printf " (seqs)"
+ seq_alters=""
+ for seq in $sequences; do
+ orgseqval=$(psql_query <<END
+ SELECT start_value || ' ' || last_value FROM $seq
+END
+ )
+ read orgstart orglast <<END
+$orgseqval
+END
+ newlast=$(( 10000 * (2 + $orglast / 10000) ))
+ seq_alters+="
+ ALTER SEQUENCE $seq
+ START WITH $orgstart
+ RESTART WITH $newlast;
+"
+ done
+ (withtest psql_do <<END
+$seq_alters
+END
+ )
+
printf ".\n"
# Schema should now be identical to main DB
SET CONSTRAINTS ALL DEFERRED;
END
- $(get_pgdump_cmd) -a -O -x ${sequences// / -t } >$t.sequences-import
- perl <$t.sequences-import >>$t.import -ne '
- next if m/^--/;
- next if m/^SET /;
- next unless m/\S/;
- print or die $!;
- '
-
for table in $tables; do
case " $ftables " in
*" $table "*) condition="flight >= $minflight" ;;
rm -f $t.tabledata.*
- printf "flightseq..."
-
- lastflight=$(psql_query <<END
- SELECT last_value FROM flights_flight_seq
-END
- )
- newlastflight=$(( 10000 * (2 + $lastflight / 10000) ))
-
- withtest psql_do <<END
- ALTER SEQUENCE flights_flight_seq
- RESTART WITH $newlastflight;
-END
-
#---------- actually borrow resources ----------
printf "borrow..."