DEV Community

Vadym Dobroskok
Vadym Dobroskok

Posted on Edited on

Find SQLite Schema Drift with Codex via GateRook

The same version of a job worker starts in one environment and fails in another: no such column: retry_after_ms. Before rerunning a migration, find out what each database actually contains. This walkthrough gives Codex a read-only path to two SQLite files through GateRook and asks it to name the exact difference.

Give the worker two different schemas

Use two disposable files. Both have a jobs table, but only the reference copy has the retry column. You can reproduce the case with the SQLite CLI:

mkdir -p sqlite-schema-demo
cd sqlite-schema-demo
sqlite3 baseline.db 'CREATE TABLE jobs (id INTEGER PRIMARY KEY, status TEXT NOT NULL);'
sqlite3 expected.db 'CREATE TABLE jobs (id INTEGER PRIMARY KEY, status TEXT NOT NULL, retry_after_ms INTEGER NOT NULL DEFAULT 0);'
Enter fullscreen mode Exit fullscreen mode

Keep the files in this separate demo directory, not in GateRook's own profile directory. The worker error is the scenario for the exercise; you don't need to install or run a worker.

Connect both files, with writes off

In GateRook, add two SQLite connections named baseline and expected. Select the matching files. Attach both connections to the same dedicated demo endpoint. In its tool settings, leave Describe a table available and turn off Change data. For this check, you don't need to enable arbitrary SQL queries.

GateRook's SQLite setup form with the file field empty

GateRook 2.0.0 documentation screenshot: the SQLite file picker before selecting a demo file.

GateRook endpoint selector with the default endpoint

Documentation screenshot: the endpoint selector. Choose your dedicated demo endpoint instead of the default shown here.

From that endpoint's Connect an AI app setup, select Codex and complete the connection in a demo workspace. The request path is Codex → GateRook's MCP endpoint → the two local SQLite files. Before running the prompt, confirm that the endpoint lists both files under their distinct names. A prompt alone is not a read-only boundary; use the tool settings and disposable files.

Ask for evidence from each file

Use GateRook's sql_describe_table tool twice: describe main.jobs on the baseline connection and then on expected. Compare column names, types, nullability, and defaults. Name each connection in your answer. Tell me if there is a column present in only one file. Do not run other SQL, edit either file, or apply a migration. Separate the observed difference from any guess about its cause.

Naming both connections matters: the table name is identical, and a good-looking answer based on just one file is useless. If a call fails, ask the assistant to report the failed connection instead of inferring its schema.

What the two calls returned

In the isolated GateRook 2.0.0 test, sql_describe_table ran once per connection. These are the relevant fields from those calls:

Connection Columns returned Retry column
baseline id, status Absent
expected id, status, retry_after_ms INTEGER, nullable: false, default 0

If your deployment points to a database shaped like baseline, that difference explains why a query referencing the column would fail there. It doesn't tell you why the column is missing. Before applying a migration, check which file the worker actually opens, which migration should add the column, and whether it ran against that file.

The demo uses schema metadata instead of application rows. You can reuse the same workflow to compare a saved snapshot against a staging copy, or to check whether two developer databases agree after a branch switch. GateRook source on GitHub.

Top comments (0)