Project

General

Profile

« Previous | Next » 

Revision 1937

main Makefile: VegBIEN DB: db: Use template0 to allow encodings other than UTF-8. Because template0 doesn't have plpgsql on PostgreSQL before 9.x, add "CREATE PROCEDURAL LANGUAGE plpgsql;" manually in schemas/vegbien.sql.make, and filter it back out on PostgreSQL after 9.x using db_dump_localize.

View differences:

schemas/vegbien.sql.make
3 3

  
4 4
selfDir="$(dirname -- "$0")"
5 5

  
6
# Not part of public schema
7
cat <<EOF
8
--
9
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: 
10
--
11

  
12
CREATE PROCEDURAL LANGUAGE plpgsql;
13

  
14

  
15
EOF
16

  
6 17
"$selfDir/../bin/postgres_vegbien" pg_dump --schema=public --schema-only \
7 18
--no-owner --no-privileges
schemas/vegbien.my.sql
1 1
--
2
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: 
3
--
4

  
5

  
6

  
7

  
8
--
2 9
-- PostgreSQL database dump
3 10
--
4 11

  
schemas/vegbien.sql
1 1
--
2
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: 
3
--
4

  
5
CREATE PROCEDURAL LANGUAGE plpgsql;
6

  
7

  
8
--
2 9
-- PostgreSQL database dump
3 10
--
4 11

  
Makefile
170 170
db: schemas/vegbien.sql _always
171 171
	-echo "CREATE USER bien PASSWORD '$(bienPassword)';"|$(psqlAsAdmin)
172 172
	-echo "CREATE DATABASE vegbien OWNER bien ENCODING 'UTF8' \
173
TEMPLATE template1;"|$(psqlAsAdmin)
174
	$(psqlAsBien) <$<
173
TEMPLATE template0;"|$(psqlAsAdmin)
174
	<$< bin/db_dump_localize|$(psqlAsBien)
175 175
# ignore errors if user or database exists
176 176

  
177 177
confirmRmDb = $(call confirm,WARNING: This will delete your VegBIEN DB!\

Also available in: Unified diff