1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
Appellation: shepherd-registry <library>
Created At: 2026.08.12:16:20:00
Contrib: @FL03
*/
//! # shepherd-registry
//!
//! The SQLite registry: schema, migration runner, and query surface.
//!
//! ## Why this is a crate and not a module
//!
//! **The registry schema is a cross-harness contract, not CLI stdout.** The
//! native CLI and embedders use this crate's typed API; adapters do not carry a
//! second schema runner. Isolating the surface means a consumer can link the
//! registry without linking the command-line interface, and `shepherd-core`
//! never acquires an I/O backend.
//!
//! ## The contract this crate owes
//!
//! - **21** migration files port **verbatim**: `0001_init.sql` (the baseline
//! schema, applied first) plus the 20 files under `migrations/`
//! (`0002`-`0021`). `0001_init.sql` sits at the schema-dir TOP LEVEL, not
//! under `migrations/`. A runner that globs only `migrations/*.sql` silently
//! skips the baseline. [`migrate::apply_all`]
//! applies both, in order, and never skips version 1. Migration SQL is the
//! portable artifact. `rusqlite_migration` is not used because it tracks
//! state in `user_version`, while this schema owns `schema_versions`.
//! - FTS5 external-content tables keep the `unicode61 remove_diacritics 2`
//! tokenizer and all 6 sync triggers.
//! - `json_valid()` CHECK constraints are asserted by **behavior**, never by
//! probing `PRAGMA compile_options` for `ENABLE_JSON1`. That flag is absent
//! on 3.53.2 and `json_valid` still works, because JSON went core in 3.38.
//!
//! Acceptance is an order-normalized `sqlite_master` fingerprint plus native
//! migration, query, and layout tests.
compile_error!
extern crate alloc;
pub use shepherd_core as core;
// modules (public)
// re-exports
pub use ;
pub use ;
// prelude