DB 동작 검수 필요 작업 완료

This commit is contained in:
mskim 2025-12-15 15:21:23 +09:00
parent 2a74e6a8e7
commit f28a530e85
1 changed files with 22 additions and 3 deletions

View File

@ -4,10 +4,29 @@
-- 이 스크립트는 postgres superuser로 실행해야 합니다.
-- 실행 방법: psql -U postgres -f database_setup.sql
-- 1. 데이터베이스 생성 (필요한 경우)
-- CREATE DATABASE dewey_memory;
-- 1. dewey 사용자 생성 (이미 존재하면 스킵)
DO $$
BEGIN
IF NOT EXISTS (SELECT FROM pg_user WHERE usename = 'dewey') THEN
CREATE USER dewey WITH PASSWORD '0bk1rWu98mGl5ea3';
RAISE NOTICE 'dewey 사용자가 생성되었습니다.';
ELSE
RAISE NOTICE 'dewey 사용자가 이미 존재합니다.';
END IF;
END $$;
-- 2. dewey_memory 데이터베이스에 연결
-- 2. dewey_memory 데이터베이스 생성 (이미 존재하면 스킵)
DO $$
BEGIN
IF NOT EXISTS (SELECT FROM pg_database WHERE datname = 'dewey_memory') THEN
CREATE DATABASE dewey_memory OWNER dewey;
RAISE NOTICE 'dewey_memory 데이터베이스가 생성되었습니다.';
ELSE
RAISE NOTICE 'dewey_memory 데이터베이스가 이미 존재합니다.';
END IF;
END $$;
-- 3. dewey_memory 데이터베이스에 연결
\c dewey_memory
-- 3. pgvector 확장 설치 (superuser 권한 필요)