Skip to content
Back to skills

Add Migration

ASecurity

Use when adding or changing a database schema in Lyntai.Storage.Sqlite (a new FluentMigrator migration — new table, column, index, or FTS search table). Covers safe numbering, SQLite constraints, and the FTS trigger pattern.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
ai-agentsgosqlnodedatabasebackend

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add JiarongGu/Lyntai --skill add-migration --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Add Migration?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Add Migration
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jiaronggu-add-migration-lyntai/badge)](https://www.skillsdirectory.com/skills/jiaronggu-add-migration-lyntai)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: add-migration
description: Use when adding or changing a database schema in Lyntai.Storage.Sqlite (a new FluentMigrator migration — new table, column, index, or FTS search table). Covers safe numbering, SQLite constraints, and the FTS trigger pattern.
---

# Add a migration to Lyntai.Storage.Sqlite

Read `.agents/knowledge/storage.md` §Migrations and §FTS5 first — the one statement of the traps; each step
below is the rule and the why is there. Never hand-pick a migration number: a reused one is skipped silently.

## Steps
1. Scaffold: `node devtools/dev.mjs new-migration <name>` → creates
   `src/Lyntai.Storage.Sqlite/Migrations/M<num>_<Name>.cs` with a unique, monotonic `yyyyMMddHHmm`
   number, the `[Migration(<num>)]` class, and a `[Tags(...)]` placeholder that deliberately does not
   compile until you name the feature (step 2). It numbers above both backends and names the Postgres twin.
2. Fill the tag and `Up()`:
   - [ ] Tag it: `[Tags(nameof(StorageFeature.<Feature>), StorageFeatures.AllTag)]` — both, always.
   - [ ] Prefix every object `lyntai_`. snake_case columns.
   - [ ] Composite PK + FK **inline at `Create.Table`**; `ON DELETE CASCADE` via raw `Execute.Sql` if needed.
   - [ ] A 0..1/double column? `CAST(x AS REAL)` wherever a SQLite-only statement SELECTs it, `CAST(x AS
         DOUBLE PRECISION)` in one both dialects share (`.agents/knowledge/storage.md` §The integer-affinity trap).
   - [ ] Searchable text? Copy `M202607280003_Memory.cs` exactly (trigram mirror, three triggers, backfill);
         adjust columns only.
3. If it's a new domain: the `I<Domain>Store` interface in Core, with every statement both dialects can run
   in ONE Core class (`src/Lyntai.Core/Storage/<Domain>StoreSql.cs`, as `KeyValueStoreSql` —
   `docs/DECISIONS.md` D187); a constructor for it on `RelationalBackend` and its `StorageFeature` branch in
   `StoreWiring.Wire` (`src/Shared/Relational/StoreWiring.cs`, D186), supplied by both adapters — never a
   `TryAddSingleton` in `UseSqliteStorage`, which runs over another wiring's factory (`docs/FIXES.md`
   2026-09-25). Then the SQLite impl, the **Postgres impl plus a Postgres migration carrying the SAME
   number** (`src/Lyntai.Storage.Postgres/Migrations/` mirrors SQLite file-for-file bar the one exception
   `.agents/knowledge/storage.md` §Migrations names, and NOTHING fails if you forget the twin —
   `docs/DECISIONS.md` D9), and an InMemory implementation in `src/Lyntai.Storage.Basic/InMemory/` (a
   Governance domain's in-memory default lives in Core). Then a `<Domain>StoreContract` fact class in
   `tests/Lyntai.Tests/Storage/` and a `<Domain>StoreContractFacts` base over `StoreContractSuite<T>` whose one
   `[ContractFacts]` theory runs it, derived once per backend — Postgres in `PostgresContractTests`;
   `StoreContractCoverageTests` fails a contract no base drives and a shipped store no suite runs. The contract facts, not a shared base class,
   keep the backends from drifting (`.agents/knowledge/storage.md` §Don't "dedup" the Sqlite/Postgres stores). If it's a change to an
   existing table, update the affected store's SQL.
4. Add/extend the integration test against a temp db (migrate → round-trip; prove FTS recall if you added
   search).
5. `node devtools/dev.mjs verify` green (the runner is idempotent; re-running is a no-op).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.