consistent management of incremental schema migration
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Mon, 7 Oct 2013 15:52:02 +0000 (17:52 +0200)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Mon, 7 Oct 2013 15:52:02 +0000 (17:52 +0200)
TODO.txt
sql/builder.sh
sql/sql.d/060-tournament.sql

index d361949..9def6a8 100644 (file)
--- 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
index 4acc242..83843d3 100755 (executable)
@@ -14,7 +14,8 @@ usage () {
     echo "       rebuild"
     echo "       psql"
     echo "       piped"
-    echo "       add <filesql>"
+    echo "       add <filesql> [<filesql2> [..]]"
+    echo "       del <filesql> [<filesql2> [..]]"
     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
index b26a1b1..7f9e340 100644 (file)
@@ -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