1 |
dpavlin |
1.1 |
db=nn |
2 |
|
|
|
3 |
|
|
all: |
4 |
|
|
@echo dump,create,drop,insert,fill |
5 |
|
|
|
6 |
|
|
dump: |
7 |
|
|
pg_dump $(db) > $(db).sql |
8 |
|
|
|
9 |
|
|
create: |
10 |
|
|
createdb $(db) |
11 |
|
|
drop: |
12 |
|
|
psql -c "drop database $(db)" template1 |
13 |
|
|
|
14 |
|
|
insert: |
15 |
|
|
cat $(db).sql |\ |
16 |
|
|
sed -e 's/::"*text"*//gi' -e 's/::"*bool"*//gi' -e 's/::"*varchar"*//gi' -e 's/::"*bpchar"*//gi' |\ |
17 |
|
|
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) |
18 |
|
|
|
19 |
|
|
fill: drop create insert |
20 |
|
|
|