|
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 | |
|---|
| 6 | DB=`cat db` |
|---|
| 7 | |
|---|
| 8 | CURRENT=`./current` |
|---|
| 9 | echo Current is $CURRENT |
|---|
| 10 | |
|---|
| 11 | LATEST=`ls -vr [0-9]*.sql |head -n1 |egrep -o "^[0-9]+"` |
|---|
| 12 | echo Latest is $LATEST |
|---|
| 13 | |
|---|
| 14 | PENDING="" |
|---|
| 15 | for (( 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 |
|---|
| 23 | done |
|---|
| 24 | |
|---|
| 25 | echo OK |
|---|
Note: See
TracBrowser
for help on using the repository browser.