Files
document-server/backend/migrations/010_create_notebooks.sql
Hyungi Ahn 3e0a03f149 🐛 Fix Alpine.js SyntaxError and backlink visibility issues
- Fix SyntaxError in viewer.js line 2868 (.bind(this) issue in setTimeout)
- Resolve Alpine.js 'Can't find variable' errors (documentViewer, goBack, etc.)
- Fix backlink rendering and persistence during temporary highlights
- Add backlink protection and restoration mechanism in highlightAndScrollToText
- Implement Note Management System with hierarchical notebooks
- Add note highlights and memos functionality
- Update cache version to force browser refresh (v=2025012641)
- Add comprehensive logging for debugging backlink issues
2025-08-26 23:50:48 +09:00

26 lines
1.1 KiB
SQL

-- 노트북 시스템 생성
CREATE TABLE notebooks (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
title VARCHAR(500) NOT NULL,
description TEXT,
color VARCHAR(7) DEFAULT '#3B82F6', -- 헥스 컬러 코드
icon VARCHAR(50) DEFAULT 'book', -- FontAwesome 아이콘 이름
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW(),
created_by VARCHAR(100) NOT NULL,
is_active BOOLEAN DEFAULT true,
sort_order INTEGER DEFAULT 0
);
-- 노트북-노트 관계 테이블 (기존 notes_documents의 parent_note_id 대신 사용)
ALTER TABLE notes_documents ADD COLUMN notebook_id UUID REFERENCES notebooks(id);
-- 인덱스 생성
CREATE INDEX idx_notebooks_created_by ON notebooks(created_by);
CREATE INDEX idx_notebooks_created_at ON notebooks(created_at);
CREATE INDEX idx_notes_notebook_id ON notes_documents(notebook_id);
-- 기본 노트북 생성 (기존 노트들을 위한)
INSERT INTO notebooks (title, description, created_by, color, icon)
VALUES ('기본 노트북', '분류되지 않은 노트들', 'admin@test.com', '#6B7280', 'sticky-note');