source: upgrade

Last change on this file was 4, checked in by David Owen <david.owen@…>, 14 years ago

Be more explicit about where the copyright applies

  • Property executable set to True
File size: 502 bytes
Line 
1#!/bin/bash
2
3# Copyright (c) 2012 David Owen <dsowen@fugue88.ws>
4# Licensed under the Academic Free License version 3.0.
5
6DB=`cat db`
7
8CURRENT=`./current`
9echo Current is $CURRENT
10
11LATEST=`ls -vr [0-9]*.sql |head -n1 |egrep -o "^[0-9]+"`
12echo Latest is $LATEST
13
14PENDING=""
15for (( I = $CURRENT + 1 ; I <= LATEST ; I++ )) ; do
16        F=`ls $I-*.sql`
17        echo Applying $F
18        G=`mktemp`
19        cp $F $G
20        echo "UPDATE db_schema SET version = $I;" >>$G
21        psql -v ON_ERROR_STOP=TRUE -1 -f $G $DB || exit 1
22        rm $G
23done
24
25echo OK
Note: See TracBrowser for help on using the repository browser.