feat: 初始化 AstroResearch 核心系统代码及重构技术文档
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
-- migrations/20260608000000_init.sql
|
||||
|
||||
CREATE TABLE IF NOT EXISTS papers (
|
||||
bibcode TEXT PRIMARY KEY,
|
||||
title TEXT NOT NULL,
|
||||
authors TEXT, -- JSON array of author names
|
||||
year TEXT,
|
||||
pub TEXT, -- journal / publisher
|
||||
keywords TEXT, -- JSON array of keywords
|
||||
abstract TEXT,
|
||||
doi TEXT,
|
||||
arxiv_id TEXT,
|
||||
citation_count INTEGER DEFAULT 0,
|
||||
reference_count INTEGER DEFAULT 0,
|
||||
pdf_path TEXT,
|
||||
html_path TEXT,
|
||||
markdown_path TEXT,
|
||||
translation_path TEXT,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS citations_references (
|
||||
source_bibcode TEXT NOT NULL,
|
||||
target_bibcode TEXT NOT NULL,
|
||||
PRIMARY KEY (source_bibcode, target_bibcode)
|
||||
);
|
||||
|
||||
-- Indexes for performance
|
||||
CREATE INDEX IF NOT EXISTS idx_papers_doi ON papers(doi);
|
||||
CREATE INDEX IF NOT EXISTS idx_papers_arxiv_id ON papers(arxiv_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_citations_ref_source ON citations_references(source_bibcode);
|
||||
CREATE INDEX IF NOT EXISTS idx_citations_ref_target ON citations_references(target_bibcode);
|
||||
@@ -0,0 +1,15 @@
|
||||
-- migrations/20260608000001_notes.sql
|
||||
-- 笔记/高亮表:每条记录对应一篇文献中某个段落的标注笔记
|
||||
|
||||
CREATE TABLE IF NOT EXISTS notes (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
bibcode TEXT NOT NULL,
|
||||
paragraph_index INTEGER NOT NULL, -- 在文章 Markdown 段落中的序号(从 0 开始)
|
||||
note_text TEXT NOT NULL DEFAULT '',
|
||||
highlight_color TEXT NOT NULL DEFAULT 'yellow', -- 'yellow' | 'green' | 'blue' | 'pink'
|
||||
selected_text TEXT NOT NULL DEFAULT '', -- 被高亮选中的原始文本片段
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (bibcode) REFERENCES papers(bibcode) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_notes_bibcode ON notes(bibcode);
|
||||
Reference in New Issue
Block a user