You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
919 B
SQL
19 lines
919 B
SQL
-- Create separate databases for each service
|
|
SELECT 'CREATE DATABASE game_sessions'
|
|
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'game_sessions')\gexec
|
|
SELECT 'CREATE DATABASE questions'
|
|
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'questions')\gexec
|
|
SELECT 'CREATE DATABASE users'
|
|
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'users')\gexec
|
|
SELECT 'CREATE DATABASE leaderboards'
|
|
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'leaderboards')\gexec
|
|
SELECT 'CREATE DATABASE admin'
|
|
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'admin')\gexec
|
|
|
|
-- Grant privileges
|
|
GRANT ALL PRIVILEGES ON DATABASE game_sessions TO knowfoolery;
|
|
GRANT ALL PRIVILEGES ON DATABASE questions TO knowfoolery;
|
|
GRANT ALL PRIVILEGES ON DATABASE users TO knowfoolery;
|
|
GRANT ALL PRIVILEGES ON DATABASE leaderboards TO knowfoolery;
|
|
GRANT ALL PRIVILEGES ON DATABASE admin TO knowfoolery;
|