From 75e9d0fde7b60527ec0ac44563cc7917ffc36126 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Mon, 7 Oct 2013 17:52:02 +0200 Subject: [PATCH] consistent management of incremental schema migration --- TODO.txt | 1 + sql/builder.sh | 10 +++++++--- sql/sql.d/060-tournament.sql | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/TODO.txt b/TODO.txt index d361949..9def6a8 100644 --- a/TODO.txt +++ b/TODO.txt @@ -12,6 +12,7 @@ . add command to continue . investigate user reordering + . manage old games - WEBSOCKET TRANSPORT . refactoring $enc attribute management diff --git a/sql/builder.sh b/sql/builder.sh index 4acc242..83843d3 100755 --- a/sql/builder.sh +++ b/sql/builder.sh @@ -14,7 +14,8 @@ usage () { echo " rebuild" echo " psql" echo " piped" - echo " add " + echo " add [ [..]]" + echo " del [ [..]]" echo " dump [dumpfile]" echo " dumpall [dumpfile]" echo " all" @@ -145,7 +146,10 @@ case $CMD in fi ;; "add") - cat "$1" | sqlexe + ( echo "-- MESG: add start" ; cat "$@" | egrep -iv "$MATCH_DROP" ; echo "-- MESG: add end" ; ) | sqlexe + ;; + "del") + ( echo "-- MESG: del start" ; cat "$@" | egrep -i "$MATCH_DROP" | tac ; echo "-- MESG: del end" ; ) | sqlexe ;; "help"|"-h"|"--help") usage 0 @@ -155,4 +159,4 @@ case $CMD in ;; esac -exit 0 \ No newline at end of file +exit 0 diff --git a/sql/sql.d/060-tournament.sql b/sql/sql.d/060-tournament.sql index b26a1b1..7f9e340 100644 --- a/sql/sql.d/060-tournament.sql +++ b/sql/sql.d/060-tournament.sql @@ -17,4 +17,4 @@ ALTER TABLE #PFX#bin5_matches DROP CONSTRAINT #PFX#bin5_matches_tcode_fkey; ALTER TABLE #PFX#bin5_matches ADD FOREIGN KEY (tcode) REFERENCES #PFX#bin5_tournaments(code) ON UPDATE cascade ON DELETE cascade; ALTER TABLE #PFX#bin5_games DROP COLUMN act; -ALTER TABLE #PFX#bin5_games ADD COLUMN act integer; -- end reason of the game +ALTER TABLE #PFX#bin5_games ADD COLUMN act integer DEFAULT -1; -- end reason of the game -- 2.17.1