-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDatabaseCreate.lddl
More file actions
50 lines (40 loc) · 1.17 KB
/
DatabaseCreate.lddl
File metadata and controls
50 lines (40 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* This script can be used to create the LAPPS database in PostgreSQL. Any
* existing database is dropped before a new one is created.
*
* The indices and stored procedure can not be added at this time as the
* service manager needs to be run to create all the required tables.
*/
// Connect as the PostgreSQL superuser since we need to drop
// an entire database.
if (args.username == null || args.password == null) {
println "Please provide a username and password to use."
return
}
postgres {
url 'jdbc:postgresql://localhost'
username args.username
password args.password
}
comment 'Dropping the existing database.'
sql 'drop database if exists langrid'
// The SQL required to create the database.
def create_stmt = """
CREATE DATABASE langrid
WITH OWNER = langrid
ENCODING = 'UTF8'
TABLESPACE = pg_default
CONNECTION LIMIT = -1;
"""
// The original create statement.
def old_create_stmt = """
CREATE DATABASE langrid
WITH OWNER = langrid
ENCODING = 'UTF8'
TABLESPACE = pg_default
LC_COLLATE = 'C'
LC_CTYPE = 'C'
CONNECTION LIMIT = -1;
"""
comment 'Creating the new database.'
sql create_stmt