-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82bfc6c
commit 95ce487
Showing
3 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# POSTGRES DB | ||
PG_PORT=5432 | ||
PG_HOST=jasma-pg-db | ||
POSTGRES_DB=postgres | ||
POSTGRES_DB=jasma | ||
POSTGRES_USER=postgres | ||
POSTGRES_PASSWORD=postgres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-- Check if the version file exists | ||
DO $$ | ||
BEGIN | ||
IF NOT EXISTS (SELECT 1 FROM pg_database WHERE datname = 'jasma') THEN | ||
-- The database should only be created on the first run / build of postgresql. | ||
-- Create the jasma database | ||
CREATE DATABASE jasma | ||
WITH | ||
OWNER = postgres | ||
TEMPLATE = template0 | ||
ENCODING = 'UTF8' | ||
LC_COLLATE = 'C' | ||
LC_CTYPE = 'C' | ||
TABLESPACE = pg_default | ||
CONNECTION LIMIT = -1 | ||
IS_TEMPLATE = False; | ||
|
||
COMMENT ON DATABASE jasma | ||
IS 'Primary PS-SQL Database of JASMA'; | ||
|
||
-- Connect to the jasma database | ||
\c jasma; | ||
|
||
-- Create the app schema | ||
CREATE SCHEMA app; | ||
|
||
-- Create the analytics schema | ||
CREATE SCHEMA analytics; | ||
|
||
-- Create the version file indicating the initialization is done | ||
CREATE TABLE IF NOT EXISTS init_version (version INT); | ||
INSERT INTO init_version (version) VALUES (1); | ||
END IF; | ||
END $$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters