feat: add vocabulary handbook import pipeline

This commit is contained in:
Codex
2026-06-22 00:11:01 +08:00
parent c1159f8745
commit b458317a81
13 changed files with 2448 additions and 186 deletions

View File

@@ -0,0 +1,39 @@
alter table public.vocabulary_units
add column if not exists entry_id uuid references public.content_entries(id) on delete set null,
add column if not exists content_node_id uuid references public.content_nodes(id) on delete set null,
add column if not exists source_hash text,
add column if not exists metadata jsonb not null default '{}'::jsonb;
alter table public.vocabulary_words
add column if not exists entry_id uuid references public.content_entries(id) on delete set null,
add column if not exists content_node_id uuid references public.content_nodes(id) on delete set null,
add column if not exists source_hash text,
add column if not exists metadata jsonb not null default '{}'::jsonb;
alter table public.handbook_subjects
add column if not exists entry_id uuid references public.content_entries(id) on delete set null,
add column if not exists content_node_id uuid references public.content_nodes(id) on delete set null,
add column if not exists source_hash text;
alter table public.handbook_chapters
add column if not exists entry_id uuid references public.content_entries(id) on delete set null,
add column if not exists content_node_id uuid references public.content_nodes(id) on delete set null,
add column if not exists source_hash text,
add column if not exists metadata jsonb not null default '{}'::jsonb;
alter table public.handbook_entries
add column if not exists entry_id uuid references public.content_entries(id) on delete set null,
add column if not exists content_node_id uuid references public.content_nodes(id) on delete set null,
add column if not exists source_hash text,
add column if not exists metadata jsonb not null default '{}'::jsonb;
create index if not exists idx_vocabulary_units_navigation
on public.vocabulary_units(tenant_id, entry_id, content_node_id, region_id, is_active, sort_order);
create index if not exists idx_vocabulary_words_navigation
on public.vocabulary_words(tenant_id, entry_id, content_node_id, unit_id, is_active, sort_order);
create index if not exists idx_handbook_subjects_navigation
on public.handbook_subjects(tenant_id, entry_id, content_node_id, region_id, is_active, sort_order);
create index if not exists idx_handbook_chapters_navigation
on public.handbook_chapters(tenant_id, entry_id, content_node_id, subject_id, is_active, sort_order);
create index if not exists idx_handbook_entries_navigation
on public.handbook_entries(tenant_id, entry_id, content_node_id, chapter_id, is_active, sort_order);