From 2066dc834ebee17b827b211a226c314a29bd38d9 Mon Sep 17 00:00:00 2001 From: "dhanush.s" Date: Thu, 4 Sep 2025 19:30:12 +0530 Subject: [PATCH] feat: postgres docker compose --- .gitignore | 3 +++ .gitmodules | 3 +++ backend | 1 + docker-compose.yaml | 18 ++++++++++++++++++ init.sql | 13 +++++++++++++ 5 files changed, 38 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 160000 backend create mode 100644 docker-compose.yaml create mode 100644 init.sql diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2c9cd39 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.env +.venv +frontend \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..cf1828c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "backend"] + path = backend + url = git@git.opsmonsters.in:opsmonsters/lolita-backend.git diff --git a/backend b/backend new file mode 160000 index 0000000..df20ceb --- /dev/null +++ b/backend @@ -0,0 +1 @@ +Subproject commit df20ceb45125c259dac552807f2cd08db44cf0e7 diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..33f14f4 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,18 @@ +services: + postgres: + image: postgres:15 + container_name: my_postgres + restart: unless-stopped + ports: + - "${POSTGRES_PORT}:5432" + environment: + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_DB: ${POSTGRES_DB} + volumes: + - postgres_data:/var/lib/postgresql/data + - ./init.sql:/docker-entrypoint-initdb.d/init.sql + +volumes: + postgres_data: + diff --git a/init.sql b/init.sql new file mode 100644 index 0000000..47f834a --- /dev/null +++ b/init.sql @@ -0,0 +1,13 @@ +CREATE TABLE IF NOT EXISTS users ( + id SERIAL PRIMARY KEY, + email VARCHAR(255) UNIQUE NOT NULL, + hashed_password VARCHAR(255) NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE IF NOT EXISTS otps ( + id SERIAL PRIMARY KEY, + email VARCHAR(255) NOT NULL, + otp VARCHAR(6) NOT NULL, + created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP +);