DB Migrations
kurealnum/dotfiles
A skill your agent uses when generating or regenerating Drizzle migration files, changing database schema tables or columns, resolving migration sequence conflicts after rebase, reviewing migration…
A skill your agent uses when adding a DB migration or a new column/field to a Becca entity in Trilium ("add a migration", "new column on notes/attributes", "ALTER TABLE", "add a field to…
$ npx skills add TriliumNext/Trilium --skill evolving-the-data-model -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install TriliumNext/Trilium evolving-the-data-model --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/TriliumNext/Trilium.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/evolving-the-data-model .claude/skills/evolving-the-data-model && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "evolving-the-data-model" agent skill from https://github.com/TriliumNext/Trilium/tree/main/.claude/skills/evolving-the-data-model into .claude/skills/evolving-the-data-model/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "evolving-the-data-model", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/TriliumNext/Trilium/tree/main/.claude/skills/evolving-the-data-modelType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add TriliumNext/Trilium --skill evolving-the-data-model -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install TriliumNext/Trilium evolving-the-data-model --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/TriliumNext/Trilium.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.claude/skills/evolving-the-data-model .agents/skills/evolving-the-data-model && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "evolving-the-data-model" agent skill from https://github.com/TriliumNext/Trilium/tree/main/.claude/skills/evolving-the-data-model into .agents/skills/evolving-the-data-model/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "evolving-the-data-model", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add TriliumNext/Trilium --skill evolving-the-data-model -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install TriliumNext/Trilium evolving-the-data-model --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/TriliumNext/Trilium.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.claude/skills/evolving-the-data-model .cursor/skills/evolving-the-data-model && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "evolving-the-data-model" agent skill from https://github.com/TriliumNext/Trilium/tree/main/.claude/skills/evolving-the-data-model into .cursor/skills/evolving-the-data-model/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "evolving-the-data-model", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/TriliumNext/Trilium.git --path .claude/skills/evolving-the-data-model--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add TriliumNext/Trilium --skill evolving-the-data-model -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install TriliumNext/Trilium evolving-the-data-model --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/TriliumNext/Trilium.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.claude/skills/evolving-the-data-model .gemini/skills/evolving-the-data-model && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "evolving-the-data-model" agent skill from https://github.com/TriliumNext/Trilium/tree/main/.claude/skills/evolving-the-data-model into .gemini/skills/evolving-the-data-model/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "evolving-the-data-model", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install TriliumNext/Trilium evolving-the-data-modelInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add TriliumNext/Trilium --skill evolving-the-data-model -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/TriliumNext/Trilium.git skills-src && mkdir -p .github/skills && cp -r skills-src/.claude/skills/evolving-the-data-model .github/skills/evolving-the-data-model && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "evolving-the-data-model" agent skill from https://github.com/TriliumNext/Trilium/tree/main/.claude/skills/evolving-the-data-model into .github/skills/evolving-the-data-model/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "evolving-the-data-model", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add TriliumNext/Trilium --skill evolving-the-data-model -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install TriliumNext/Trilium evolving-the-data-model --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/TriliumNext/Trilium.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.claude/skills/evolving-the-data-model .opencode/skills/evolving-the-data-model && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "evolving-the-data-model" agent skill from https://github.com/TriliumNext/Trilium/tree/main/.claude/skills/evolving-the-data-model into .opencode/skills/evolving-the-data-model/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "evolving-the-data-model", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
evolving-the-data-modelA skill your agent uses when adding a DB migration or a new column/field to a Becca entity in Trilium ("add a migration", "new column on notes/attributes", "ALTER TABLE", "add a field to…
Evolving The Data Model is an agent skill from TriliumNext/Trilium. Use when adding a DB migration or a new column/field to a Becca entity in Trilium ("add a migration", "new column on notes/attributes", "ALTER TABLE", "add a field to BNote/BAttribute/BBranch", schema change). Migrations are NOT dated .sql files — they are integer-versioned entries in the DESCENDING MIGRATIONS array in packages/trilium-core/src/migrations/migrations.ts (dbVersion is auto-derived from MIGRATIONS[0]), and the schema lives at packages/trilium-core/src/assets/schema.sql. Covers the full file chain…
Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files and assets (for example `assets/0NNN__migration.template.ts`, `assets/migration-spec.template.ts` and `assets/sql-migration.snippet.md`).
It sits in Databases, covering SQL and Database migrations. It works with SQL. The repository describes itself as: Build your personal knowledge base with Trilium Notes. The licence is AGPL-3.0.
2 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 134a865. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Ships script files (TypeScript), which the agent can run.
Shell commands in SKILL.md call:
pnpmFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use pnpm, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Evolving The Data Model loads about 2.1k tokens when it runs, and up to ~4.8k if it reads all its reference files. Until then it costs about 165 tokens; SKILL.md has 759 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from TriliumNext/Trilium at commit 134a865, republished under its AGPL-3.0 licence (© TriliumNext). 759 words, ~2,117 tokens.
.claude/skills/evolving-the-data-model/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub..sql files — start hereThe intuitive guess — dated SQL files under apps/server plus a matching schema.sql there — is wrong on both counts. Neither of these paths exists:
| Easy wrong guess | Reality |
|---|---|
apps/server/src/migrations/YYMMDD_HHMM__description.sql | No such directory. Migrations are not dated .sql files — they're entries in the MIGRATIONS array (below). |
apps/server/src/assets/db/schema.sql | No such file. The schema for fresh installs lives in core. |
Verified absent: Glob apps/server/src/migrations/** and Glob apps/server/src/assets/db/schema.sql both return nothing.
Ground truth:
packages/trilium-core/src/migrations/migrations.ts. One MIGRATIONS array of { version, sql, ignoreErrors? } (SQL) or { version, module } (JS) objects, kept in DESCENDING version order (newest first). Top entry today is version: 240 (migrations.ts:15).packages/trilium-core/src/assets/schema.sql.dbVersion is auto-derived, never hand-bumped: getMaxMigrationVersion() returns MIGRATIONS[0].version (migrations.ts:6-8) → appInfo.dbVersion (app_info.ts:11) → isDbUpToDate() compares dbVersion >= appInfo.dbVersion (migration.ts:120-130, the comparison at :123).migrations.spec.ts already asserts unique + descending versions (migrations.spec.ts:5-18), so a misordered/duplicate version IS caught at CI if you run the tests. The genuinely silent traps are:
sql.executeScript(schema) and never replay migrations (sql_init.ts:154, also :288 for sync setup). A column added only via ALTER TABLE in a migration is MISSING on every freshly-created DB unless you hand-mirror it into schema.sql. No test compares fresh-vs-migrated schema.notes, branches, attributes load via sql.getRawRows(...) (positional arrays) fed to new BAttribute().update(row), whose destructure order must match the SELECT column order exactly (becca_loader.ts:53 ↔ battribute.ts:57). Add a column to one and not the other (or in the wrong position) and every loaded entity silently gets shifted field values — no compile error, no test failure.A third, deliberate-only hazard: changing hashedProperties breaks cross-instance sync — see below.
| Task | Files to touch | Template / reference |
|---|---|---|
Pure schema/data fix (rename option, drop table, add index, plain ALTER) | migrations.ts (top entry) + schema.sql (mirror) | assets/sql-migration.snippet.md |
| Data transform needing becca/note APIs | new 0NNN__*.ts + migrations.ts (module: entry) | assets/0NNN__migration.template.ts |
| Add a column/field to an existing entity | migration + schema.sql + rows.ts Row + entity (property, updateFromRow/update/getPojo) + becca_loader SELECT | references/column-add-checklist.md |
| Change which fields are sync-hashed | entity hashedProperties only — STOP, read the hazard first | references/sync-hash-hazard.md |
MIGRATIONS with version: <current MIGRATIONS[0].version + 1> (so today, 241).ALTER TABLE ... ADD COLUMN, set ignoreErrors: true (re-running over an already-patched DB must not halt the whole transaction — see 238/236, the only two entries that set it, and the ignoreErrors doc at migrations.ts:370-371).schema.sql so fresh installs match.appInfo bump — dbVersion reads MIGRATIONS[0] automatically.// migrations.ts — TOP of the MIGRATIONS array
{
version: 241,
sql: /*sql*/`
ALTER TABLE notes ADD COLUMN color TEXT DEFAULT '' NOT NULL;
`,
ignoreErrors: true
},Use this only when the transform needs becca/note APIs (content, attachments, relations). Pure SQL? Stay in SQL.
packages/trilium-core/src/migrations/0NNN__<desc>.ts with a default-exported function.getContext().init(() => { becca_loader.load(); ... }) — without CLS context note.save()/setContent() throw. Models: 0233__migrate_geo_map_to_collection.ts:6-8, 0234__migrate_ai_chat_to_code.ts:5-7.MIGRATIONS with { version: N, module: async () => import("./0NNN__<desc>.js") } — note the .js extension (ESM output), exactly like migrations.ts:73-74..spec.ts (see the harness below).The runner preloads JS modules (prepareMigrations, migration.ts:80-101) then runs everything inside one sql.transactional (migration.ts:46); a failure without ignoreErrors crashes the app so the user can stay on the old version.
Two proven styles, both already in-tree:
test/fixtures/document.db, insert rows, run the migration fn, assert post-state. Model: migrations/0233__migrate_geo_map_to_collection.spec.ts.migration.migrateIfNecessary() against test/fixtures/document_v214.db, assert a post-migration count. Model: services/migration.spec.ts (asserts SELECT count(*) FROM blobs is 118).Three harness traps, each load-bearing (copy assets/migration-spec.template.ts):
getSql() inside beforeEach, not at describe-collection time — describe callbacks run before the suite's initializeCore beforeAll, so capturing it eagerly throws "SQL not initialized" (0233__*.spec.ts:33-39 has the explanatory comment).sql.rebuildFromBuffer(readFileSync(fixture)) per test to avoid cross-test leakage (0233__*.spec.ts:43-44).becca_loader.load() after raw INSERTs and again after running the migration, all inside cls.getContext().init(...), so becca reflects the new DB state (0233__*.spec.ts:112 and :130).Run a single migration spec:
pnpm --filter server test packages/trilium-core/src/migrations/0233__migrate_geo_map_to_collection.spec.tsFor writing the assertions themselves, see the writing-unit-tests skill (real-DB vs mocked-becca, the cls.init pattern, single-file runner footguns) and analyzing-coverage for chasing the migration's uncovered branches.
| File | When to open |
|---|---|
| references/column-add-checklist.md | Adding a column/field to notes/attributes/branches — the exact 5-file chain + the SELECT ↔ update([...]) positional diagram, with a full worked attributes example. |
| references/sync-hash-hazard.md | Touching hashedProperties, or deciding whether a new column should sync-hash. generateHash() → entity_changes → cross-instance content-hash break, with every entity's current hashedProperties list. |
| assets/sql-migration.snippet.md | Copy-paste SQL MIGRATIONS entries (ALTER ADD COLUMN + generic DDL/data) and the paired schema.sql reminder. |
| assets/0NNN__migration.template.ts | JS/TS migration skeleton with the getContext().init wrapper + the MIGRATIONS entry snippet. |
| assets/migration-spec.template.ts | Vitest harness with all three traps pre-handled. |
© TriliumNext, AGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 5 other files (references, assets) in .claude/skills/evolving-the-data-model of TriliumNext/Trilium.
Open the folder on GitHubat commit 134a865
Evolving The Data Model next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Evolving The Data Model this skillTriliumNext/Trilium | 38k | — | ~2.1k | Automated safety check: Pass | AGPL-3.0 | |
| DB Migrationskurealnum/dotfiles | 290 | — | ~820 | Automated safety check: Pass | None | |
| Forge Business Flow Developmentyaomindong1996/forge-admin | 125 | — | ~1.3k | Automated safety check: Pass | Apache-2.0 | |
| Migrationkortix-ai/suna | 20k | — | ~1.2k | Automated safety check: Pass | Custom licence | |
| Migrate Createruvnet/ruflo | 74k | — | ~583 | Automated safety check: Notes | MIT | |
| Data Modelgenkovich/sdd | 171 | — | ~4k | Automated safety check: Pass | MIT |
kurealnum/dotfiles
A skill your agent uses when generating or regenerating Drizzle migration files, changing database schema tables or columns, resolving migration sequence conflicts after rebase, reviewing migration…
yaomindong1996/forge-admin
Develop Forge business approval workflows backed by Flowable, using the current sample purchase order approval as the reference.
kortix-ai/suna
How to change the database schema in this repo. An agent skill from kortix-ai/suna.
ruvnet/ruflo
Create a new sequentially numbered database migration with up/down SQL files
genkovich/sdd
A skill your agent uses to design the data model AND generate the actual forward + rollback migrations in one pass — shippable SQL, not a plan.
FerroxLabs/wayland
CockroachDB distributed SQL expert covering multi-region deployment, survivability goals, schema design for distributed systems, online schema changes, transaction contention management, follower…
TriliumNext/Trilium
A skill your agent uses when cutting, preparing, or debugging a Trilium release — bumping the monorepo version, tagging, or diagnosing a failed "Release" workflow run.
TriliumNext/Trilium
A skill your agent uses when working on the Trilium Electron desktop app (apps/desktop) — adding or changing an electronApi method / IPC channel, touching preload.ts, main.ts, services/window.ts or…
TriliumNext/Trilium
A skill your agent uses when adding, moving, or wiring an internal REST endpoint in Trilium (a new /api/ route) — choosing between a core-shared handler (packages/trilium-core/src/routes/index.ts…
TriliumNext/Trilium
A skill your agent uses when adding, changing, or reviewing an LLM/MCP tool in Trilium (the defineTools definitions under packages/trilium-core/src/services/llm/tools/ —…
TriliumNext/Trilium
Write, extend, and review CKEditor 5 plugins in the Trilium (TriliumNext Notes) monorepo — the rich-text-note editor under packages/ckeditor5, whose plugins live in src/plugins/.
TriliumNext/Trilium
Testing CKEditor 5 plugins in the Trilium monorepo. An agent skill from TriliumNext/Trilium.
Works with
Categories
A skill your agent uses when adding a DB migration or a new column/field to a Becca entity in Trilium ("add a migration", "new column on notes/attributes", "ALTER TABLE", "add a field to…. Evolving The Data Model is an agent skill from TriliumNext/Trilium. Use when adding a DB migration or a new column/field to a Becca entity in Trilium ("add a migration", "new column on notes/attributes", "ALTER TABLE", "add a field to BNote/BAttribute/BBranch", schema change).
Evolving The Data Model fits situations like: adding a DB migration; A new column/field to a Becca entity in Trilium (add a migration; new column on notes/attributes; add a field to BNote/BAttribute/BBranch.
Run `npx skills add TriliumNext/Trilium --skill evolving-the-data-model -a claude-code`. Or copy the skill folder (.claude/skills/evolving-the-data-model in TriliumNext/Trilium) into .claude/skills/evolving-the-data-model in your project. Claude Code loads it when a task matches its description.
Run `npx skills add TriliumNext/Trilium --skill evolving-the-data-model -a codex`. Or copy the skill folder (.claude/skills/evolving-the-data-model in TriliumNext/Trilium) into .agents/skills/evolving-the-data-model in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add TriliumNext/Trilium --skill evolving-the-data-model -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/evolving-the-data-model, .gemini/skills/evolving-the-data-model, .github/skills/evolving-the-data-model and .opencode/skills/evolving-the-data-model in your project.
Going by SKILL.md and its folder, Evolving The Data Model needs TypeScript for the scripts in its folder and the command-line tools its instructions call (pnpm). Our summary lists: Node.js.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Evolving The Data Model is published under the AGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.1k tokens (SKILL.md is roughly 8.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.7k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Evolving The Data Model: DB Migrations (kurealnum/dotfiles, 290 stars), Forge Business Flow Development (yaomindong1996/forge-admin, 125 stars), Migration (kortix-ai/suna, 20k stars) and Migrate Create (ruvnet/ruflo, 74k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
TriliumNext (a GitHub organization) maintains it in TriliumNext/Trilium, which has 38,231 GitHub stars. The repository holds 22 skills in this directory. The repository was last updated on October 7, 2026.
Source: TriliumNext/Trilium on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.