- 0001_init.sql: projax.items + projax.item_links tables with indices, partial-unique root slug, updated_at trigger, schema grants to the application role. - 0002_path_trigger.sql: BEFORE-write trigger maintains items.path via recursive parent walk; rejects cycles and structural-rule violations (areas at root, projects not at root). AFTER trigger rewrites descendant paths on slug rename or re-parent. - 0003_seed_areas.sql: dev, sports, home, work, health, finances, social. - db/migrate.go: embed.FS-backed sequential runner. - db/migrate_test.go: integration suite covering idempotency, nest, rename propagation, re-parent propagation, cycle rejection, and structural rules. Skips when no DB env var is set. Also ignores .m/events.log and .m/locks (per-worker scratch).
14 lines
550 B
SQL
14 lines
550 B
SQL
-- 0003_seed_areas.sql
|
|
-- Day-one areas. Idempotent: ON CONFLICT (slug) where parent is null DO NOTHING.
|
|
|
|
insert into projax.items (kind, title, slug)
|
|
values
|
|
(array['area']::text[], 'dev', 'dev'),
|
|
(array['area']::text[], 'sports', 'sports'),
|
|
(array['area']::text[], 'home', 'home'),
|
|
(array['area']::text[], 'work', 'work'),
|
|
(array['area']::text[], 'health', 'health'),
|
|
(array['area']::text[], 'finances', 'finances'),
|
|
(array['area']::text[], 'social', 'social')
|
|
on conflict (slug) where parent_id is null do nothing;
|