-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit-db.sql
More file actions
24 lines (20 loc) · 778 Bytes
/
init-db.sql
File metadata and controls
24 lines (20 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- Initialize PostgreSQL databases for Airflow template
--
-- This script creates two separate databases:
-- 1. airflow - Airflow metadata (DAG runs, task instances, etc.)
-- 2. app - Application data (your models, business data)
--
-- This separation keeps Airflow's metadata isolated from your app data.
-- Create airflow database and user
CREATE USER airflow WITH PASSWORD 'airflow';
CREATE DATABASE airflow OWNER airflow;
GRANT ALL PRIVILEGES ON DATABASE airflow TO airflow;
-- Create app database and user
CREATE USER app WITH PASSWORD 'app';
CREATE DATABASE app OWNER app;
GRANT ALL PRIVILEGES ON DATABASE app TO app;
-- Grant schema permissions (required for PostgreSQL 15+)
\c airflow
GRANT ALL ON SCHEMA public TO airflow;
\c app
GRANT ALL ON SCHEMA public TO app;