summaryrefslogtreecommitdiff
path: root/installation/setup_db.sql
diff options
context:
space:
mode:
authorDawid Rycerz <dawid@rycerz.xyz>2025-03-23 17:11:39 +0100
committerDawid Rycerz <dawid@rycerz.xyz>2025-04-05 21:16:51 +0200
commit0ab2e5ba2b0631b28b5b1405559237b3913c878f (patch)
tree791cea788b0a62bc483d0041fbd0c655d2ad49e8 /installation/setup_db.sql
feat: initialize Phoenix application for weather alerts
This commit sets up the initial Silmataivas project structure, including: Phoenix web framework configuration, database models for users and locations, weather polling service, notification system, Docker and deployment configurations, CI/CD pipeline setup
Diffstat (limited to 'installation/setup_db.sql')
-rw-r--r--installation/setup_db.sql19
1 files changed, 19 insertions, 0 deletions
diff --git a/installation/setup_db.sql b/installation/setup_db.sql
new file mode 100644
index 0000000..3014dc0
--- /dev/null
+++ b/installation/setup_db.sql
@@ -0,0 +1,19 @@
+-- setup_db.sql
+
+-- Create user (if it doesn't exist)
+DO
+$$
+BEGIN
+ IF NOT EXISTS (
+ SELECT FROM pg_catalog.pg_roles WHERE rolname = 'silmataivas'
+ ) THEN
+ CREATE ROLE silmataivas LOGIN PASSWORD 'silmataivas';
+ END IF;
+END
+$$;
+
+-- Create database owned by the user
+CREATE DATABASE silmataivas OWNER silmataivas;
+
+-- Optional: grant all privileges explicitly
+GRANT ALL PRIVILEGES ON DATABASE silmataivas TO silmataivas; \ No newline at end of file