Initial import

This commit is contained in:
how2ice
2026-04-21 03:33:23 +09:00
commit 9e4b70f1f1
495 changed files with 94680 additions and 0 deletions

4
etc/db/work-db/.env.example Executable file
View File

@@ -0,0 +1,4 @@
POSTGRES_DB=work_db
POSTGRES_USER=work_user
POSTGRES_PASSWORD=change-me
POSTGRES_PORT=5432

2
etc/db/work-db/.gitignore vendored Executable file
View File

@@ -0,0 +1,2 @@
.env
postgres-data

28
etc/db/work-db/README.md Executable file
View File

@@ -0,0 +1,28 @@
# Work DB
로컬 개발용 PostgreSQL 컨테이너입니다.
## 실행
```bash
docker compose up -d
docker compose logs -f postgres
```
## 중지
```bash
docker compose down
```
## 기본 접속 정보
- Host: `localhost`
- Port: `.env``POSTGRES_PORT`
- Database: `.env``POSTGRES_DB`
- User: `.env``POSTGRES_USER`
- Password: `.env``POSTGRES_PASSWORD`
## work-server 연동
`etc/servers/work-server/.env`의 DB 설정과 맞춰서 사용합니다.

View File

@@ -0,0 +1,41 @@
services:
postgres:
image: postgres:16-alpine
container_name: work-db
logging:
driver: json-file
options:
max-size: "200m"
max-file: "2"
restart: unless-stopped
env_file:
- path: ./.env.example
required: false
- path: ./.env
required: false
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports:
- '${POSTGRES_PORT:-5432}:5432'
volumes:
- work-db-data:/var/lib/postgresql/data
networks:
- work-backend
healthcheck:
test:
[
'CMD-SHELL',
'pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB'
]
interval: 10s
timeout: 5s
retries: 10
volumes:
work-db-data:
networks:
work-backend:
name: work-backend

View File

@@ -0,0 +1,12 @@
create table if not exists board_posts (
id serial primary key,
title varchar(200) not null,
content text not null,
automation_plan_item_id integer null,
automation_received_at timestamptz null,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
create index if not exists idx_board_posts_updated_at
on board_posts (updated_at desc);

View File

@@ -0,0 +1,16 @@
create table if not exists notification_messages (
id serial primary key,
title varchar(200) not null,
body text not null,
category varchar(60) not null default 'general',
source varchar(80) not null default 'system',
priority varchar(20) not null default 'normal',
is_read boolean not null default false,
read_at timestamptz null,
metadata_json jsonb not null default '{}'::jsonb,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
create index if not exists idx_notification_messages_unread_created_at
on notification_messages (is_read, created_at desc, id desc);

View File

@@ -0,0 +1,34 @@
-- 방문자 마스터 테이블: clientId 단위 집계 정보 보관
create table if not exists visitor_clients (
id serial primary key,
client_id varchar(120) not null unique,
nickname varchar(80) not null,
first_visited_at timestamptz not null default now(),
last_visited_at timestamptz not null default now(),
visit_count integer not null default 1,
last_visited_url varchar(2000),
last_user_agent varchar(1000),
last_ip varchar(120),
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
create index if not exists idx_visitor_clients_last_visited_at
on visitor_clients (last_visited_at desc);
-- 방문 상세 이력 테이블: 중복 방문도 모두 적재
create table if not exists visitor_visit_histories (
id serial primary key,
client_id varchar(120) not null,
visited_at timestamptz not null default now(),
url varchar(2000) not null,
event_type varchar(80) not null default 'page_view',
user_agent varchar(1000),
ip varchar(120)
);
create index if not exists idx_visitor_visit_histories_client_id
on visitor_visit_histories (client_id);
create index if not exists idx_visitor_visit_histories_visited_at
on visitor_visit_histories (visited_at desc);