/[hr-web]/sql/Makefile
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /sql/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Wed Jun 19 16:38:10 2002 UTC (21 years, 9 months ago) by ravilov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +12 -13 lines
blah

1 db = education
2 portal = portal.pliva.hr
3
4 all:
5 @echo dump, create, drop, insert, fill
6
7 dump:
8 pg_dump "$(db)" >"$(db).sql"
9
10 create:
11 createdb "$(db)"
12
13 drop:
14 dropdb "$(db)"
15
16 insert:
17 cat "$(db).sql" | sed -e 's/::text//g' -e 's/::bool//g' | psql "$(db)"
18
19 fill: drop create insert
20
21 fill2:
22 dropdb "$(db)2"
23 createdb "$(db)2"
24 cat "$(db).sql" | sed -e 's/::text//g' -e 's/::bool//g' | psql "$(db)2"
25
26 convert: dump
27 cat "$(db).sql" | sed -e 's/::text//' -e 's/::bool//' | sed 's/ \([01][0-9]\)-\([0123][0-9]\)-\([12][0-9][0-9][0-9]\)/ \2-\1-\3/g' | sed 's,/usr/lib/pgsql/,/usr/lib/postgresql/lib/,g' > $(db)-7.sql
28
29 dist2portal:
30 psql -h $(portal) -c "drop database $(db)" template1
31 psql -h $(portal) -c "create database $(db)" template1
32 pg_dump $(db) | sed 's/::text//' | sed 's/::bool//' | sed 's/ \([01][0-9]\)-\([0123][0-9]\)-\([12][0-9][0-9][0-9]\)/ \2-\1-\3/g' | sed 's,/usr/lib/pgsql/,/usr/lib/postgresql/lib/,g' | ssh portal "psql $(db)"
33
34 dist2test:
35 psql -c "drop database $(db)" template1
36 psql -c "create database $(db)" template1
37
38 # pg_dump -h $(portal) $(db) | \
39
40 ssh portal "pg_dump $(db)" | \
41 sed -e 's/::"*text"*//gi' -e 's/::"*bool"*//gi' -e 's/::"*varchar"*//gi' -e 's/::"*bpchar"*//gi' |\
42 sed 's/ \([01][0-9]\)-\([0123][0-9]\)-\([12][0-9][0-9][0-9]\) / \2-\1-\3 /g' | sed 's,/usr/lib/pgsql/,/usr/lib/postgresql/lib/,g' | psql $(db)
43
44

  ViewVC Help
Powered by ViewVC 1.1.26