fix(library): 마이그레이션 asyncpg 다중 statement 분리

asyncpg는 prepared statement에 다중 SQL 불가.
120(테이블) → 121(unique idx) → 122(parent idx) → 123(시드) 분리.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-04-15 10:03:00 +09:00
parent 964d4ffc67
commit 32aab7784b
4 changed files with 7 additions and 9 deletions
+2 -9
View File
@@ -1,5 +1,5 @@
-- 자료실 분류 독립 관리 테이블
CREATE TABLE library_categories (
CREATE TABLE IF NOT EXISTS library_categories (
id BIGSERIAL PRIMARY KEY,
path TEXT NOT NULL,
name TEXT NOT NULL,
@@ -8,11 +8,4 @@ CREATE TABLE library_categories (
is_system BOOLEAN NOT NULL DEFAULT FALSE,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE UNIQUE INDEX uq_library_categories_path ON library_categories (path);
CREATE INDEX idx_library_categories_parent ON library_categories (parent_path);
-- 시스템 분류: 미분류
INSERT INTO library_categories (path, name, parent_path, depth, is_system)
VALUES ('미분류', '미분류', NULL, 1, TRUE);
)
@@ -0,0 +1 @@
CREATE UNIQUE INDEX IF NOT EXISTS uq_library_categories_path ON library_categories (path)
@@ -0,0 +1 @@
CREATE INDEX IF NOT EXISTS idx_library_categories_parent ON library_categories (parent_path)
@@ -0,0 +1,3 @@
INSERT INTO library_categories (path, name, parent_path, depth, is_system)
VALUES ('미분류', '미분류', NULL, 1, TRUE)
ON CONFLICT DO NOTHING