Logo: Database Migration Verification

Database Migration Verification

Communautéit
nahid-sparktales
database-migration-verification

Prove a migration did what it claimed — before/after row counts, column checksums, constraint and index state, invariant queries, an exercised application read path, and a rehearsed rollback. Use after a migration has been applied to any environment and before anyone reports it as working, or when reviewing someone else's claim that a migration succeeded. Not for planning or sequencing the migration (that is migrations), and it does not treat a clean exit code, a green CI run, or a backup's existence as proof.

Iwwersiicht

Editeurnahid-sparktales
Repositoryagent-dispatcher
Skill-Nummdatabase-migration-verification
Stären
58
Forks
5
Matgeliwwert Dateien
1
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 1 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    nahid-sparktales huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Database Migration Verification an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/nahid-sparktales/agent-dispatcher/tree/main/skills/database/database-migration-verification
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/nahid-sparktales/agent-dispatcher.git /tmp/agent-dispatcher
mkdir -p .claude/skills
cp -r /tmp/agent-dispatcher/skills/database/database-migration-verification .claude/skills/database-migration-verification
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Database Migration Verification an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Database Migration Verification automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Database Migration Verification net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Database migration verification

"The migration ran" is a fact about a process exiting. It is not a fact about the data. A migration can apply cleanly and still drop rows, leave a column half-backfilled, declare a constraint it never validated, or build an index nothing uses.

When this fires

A migration has been applied somewhere — local, branch, staging, production — and someone is about to call it done, or you are checking that claim. It fires again after any re-run or fix. It does not fire for a migration that has only been written.

Procedure

  1. Write down the claim as checkable statements before running anything. "Every order has a currency." "No order row was lost." "total equals the sum of its line items." A claim that cannot be expressed as a query cannot be verified here — mark it unverifiable rather than quietly dropping it.

  2. Get the before-state, or declare it missing. Row counts, aggregate checksums and constraint state captured before the migration ran. If nobody captured them, you can still check the after-state against the schema and the invariants — but you cannot prove nothing was lost. Say that in those words; do not let the rest of the evidence imply it.

  3. Confirm what actually ran. Read the migration history in the database and compare it to the files in the repository: which versions are recorded, in what order, at what time. A successful command exit is not the record. A migration file present in the repo but absent from the history is a finding.

  4. Count rows per affected table and compare to the before-state with the delta you predicted in advance. A mismatch is a defect. A match is necessary, not sufficient — equal counts are consistent with every value being wrong.

  5. Checksum the columns that moved. For each copied or transformed column, compare an order-independent aggregate against the source column or the before-state: sum, min/max, count of distinct values, count of nulls, and a hash aggregate over key plus value. Aggregate over the whole table, not a sample, unless the table is too large to scan — and if you sample, say you sampled and how.

  6. Check constraint and index state, not constraint and index existence. Every constraint added must be validated rather than left unvalidated — read the catalog, do not infer it from the DDL. Every index must be valid (a failed concurrent build leaves one that is not) and must actually be chosen by the query it was added for; read the execution plan. An index the planner ignores is built, not verified.

  7. Run the invariant queries for orphaned foreign keys, nulls in columns intended to be non-null, duplicates in columns intended to be unique, values outside their intended range, and any domain rule from step 1. Write them to return offending rows, not a boolean — zero rows returned is the evidence, and a non-zero result hands you the defect directly.

  8. Exercise the application's read path. A correct schema does not mean the code reads it. Run the real code path against the migrated database — the test that covers it, or the request that hits it — and check the values it returns, not just that it did not throw.

  9. Rehearse the rollback on a copy. Take a copy or branch at the migrated state, run the down path, and re-run the counts and invariant queries against the result. An unexecuted rollback is a plan. Where the rollback is a restore from backup, the rehearsal is an actual restore into a disposable target — time it and record the recovery point it lands on. Never rehearse a rollback against the environment people are using; if the only copy available is production, stop and ask.

  10. Report with the words kept apart — written, applied, executed, tested, rolled back in rehearsal, verified. Each one names something different, and this procedure exists because they get conflated.

What this refuses to conclude

  • Without a before-state: that no data was lost. Counts after the fact cannot establish it.
  • Without checksums: that a transformed column is correct. A column full of the right shape of wrong value passes every count.
  • Without a validated constraint read from the catalog: that the constraint is enforced.
  • Without an executed rollback: that the migration is reversible.
  • Without exercising the read path: that the application works against the new schema.
  • Without running against the environment in question: anything about that environment. A pass on staging is evidence about staging.

Checklist

  • Claims written as queries before running anything
  • Before-state present, or its absence stated as a limit on the conclusion
  • Migration history read and reconciled against the repository
  • Row counts compared per table against a predicted delta
  • Column checksums compared for every transformed or copied column
  • Constraints confirmed validated from the catalog; indexes confirmed valid and chosen
  • Invariant queries run, returning rows rather than booleans
  • Application read path exercised against the migrated database
  • Rollback executed on a copy, with counts re-checked and timing recorded
  • Environment named; unverified claims listed explicitly

Failure handling

  • A count or checksum disagrees — that is the result. Report the discrepancy and the query that found it. Do not re-run the backfill over the top to make the numbers match; that hides which rows were wrong.
  • Invariant query returns rows — capture the offending keys before anything else changes them. Those rows are the reproduction case.
  • The rollback fails in rehearsal — the migration is not reversible. Report it as such immediately; that fact usually changes the deployment decision.
  • No non-production copy exists to rehearse against — say the rollback is unrehearsed. Do not rehearse on the live system to fill the gap.
  • Read-only access only — the read-side checks still stand. Report them as done and the rollback rehearsal as not performed, rather than downgrading the whole verification to an opinion.

Evidence to report

The environment. The queries you ran, verbatim, with their results — before and after side by side. The migration versions recorded in the history. Constraint and index state as read from the catalog. Which read path was exercised and what it returned. The rollback rehearsal: that it ran, how long, and what the post-rollback counts were. Then the explicit list of what was not checked. A summary that says "verified" without these is a claim, not verification.

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Database Migration Verification?

Prove a migration did what it claimed — before/after row counts, column checksums, constraint and index state, invariant queries, an exercised application read path, and a rehearsed rollback. Use after a migration has been applied to any environment and before anyone reports it as working, or when reviewing someone else's claim that a migration succeeded. Not for planning or sequencing the migration (that is migrations), and it does not treat a clean exit code, a green CI run, or a backup's existence as proof.

Firwat Database Migration Verification op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Database Migration Verification besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Database Migration Verification an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/nahid-sparktales/agent-dispatcher/tree/main/skills/database/database-migration-verification an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Database Migration Verification benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Database Migration Verification benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Database Migration Verification domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Database Migration Verification gratis?

Jo. nahid-sparktales huet de Skill ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇