Data Migration Verify
Verify database migration correctness. Supports PostgreSQL, MySQL, SQLite.
Inputs
| Input |
Type |
Default |
Purpose |
db_type |
string |
required |
postgres, mysql, or sqlite |
source_db |
string |
required |
Source connection string or path |
target_db |
string |
required |
Target connection string or path |
tables |
string |
"" |
Comma-separated tables (all if empty) |
migration_name |
string |
"" |
Migration being verified |
Workflow
1. Load Persona
persona_load("developer")
2. Check Known Issues
check_known_issues("psql", "")
check_known_issues("mysql", "")
check_known_issues("sqlite", "")
3. PostgreSQL (if db_type == postgres)
psql_schemas(connection="{{ source_db }}")
psql_tables(connection="{{ source_db }}")
psql_tables(connection="{{ target_db }}")
psql_describe(connection="{{ source_db }}", table="{{ first_table }}") — if tables
psql_size(connection="{{ source_db }}")
psql_query(connection="{{ source_db }}", query="SELECT COUNT(*) FROM {{ first_table }}") — if tables
psql_query(connection="{{ target_db }}", query="SELECT COUNT(*) FROM {{ first_table }}") — if tables
4. MySQL (if db_type == mysql)
mysql_tables(connection="{{ source_db }}")
mysql_tables(connection="{{ target_db }}")
mysql_describe(connection="{{ source_db }}", table="{{ first_table }}") — if tables
mysql_show_create_table(connection="{{ source_db }}", table="{{ first_table }}") — if tables
mysql_query(connection="{{ source_db }}", query="SELECT COUNT(*) FROM {{ first_table }}") — if tables
mysql_query(connection="{{ target_db }}", query="SELECT COUNT(*) FROM {{ first_table }}") — if tables
5. SQLite (if db_type == sqlite)
sqlite_tables(database="{{ source_db }}")
sqlite_tables(database="{{ target_db }}")
sqlite_schema(database="{{ source_db }}")
sqlite_describe(database="{{ source_db }}", table="{{ first_table }}") — if tables
sqlite_query(database="{{ source_db }}", query="SELECT COUNT(*) FROM {{ first_table }}") — if tables
sqlite_query(database="{{ target_db }}", query="SELECT COUNT(*) FROM {{ first_table }}") — if tables
6. Podman (optional)
podman_exec(container="{{ source_db }}", command="echo 'database container accessible'") — if source is container
7. Failure Learning
- "connection refused" →
learn_tool_fix("{{ db_type }}", "connection refused", "Database server not running", "Start DB or podman start <container>")
- "does not exist" → target DB not created
8. Memory
memory_session_log("Data migration verify", "db_type={{ db_type }}, migration={{ migration_name }}")
Error Recovery
| Error |
Action |
| "connection refused" |
Start database server, check connection params |
| "database does not exist" |
Create target database before migration |
Output
Report: schemas, source/target tables, table descriptions, row counts, database size (Postgres), CREATE TABLE (MySQL), known issues. Compare source vs target for schema/row count mismatches.
Chains To
1---2name: data-migration-verify3description: Verify database migration correctness across PostgreSQL, MySQL, and SQLite. Compare source/target schemas, table structures, row counts. Use when validating migrations or data integrity.4---56# Data Migration Verify78Verify database migration correctness. Supports PostgreSQL, MySQL, SQLite.910## Inputs1112| Input | Type | Default | Purpose |13|-------|------|---------|---------|14| `db_type` | string | required | postgres, mysql, or sqlite |15| `source_db` | string | required | Source connection string or path |16| `target_db` | string | required | Target connection string or path |17| `tables` | string | "" | Comma-separated tables (all if empty) |18| `migration_name` | string | "" | Migration being verified |1920## Workflow2122### 1. Load Persona23- `persona_load("developer")`2425### 2. Check Known Issues26- `check_known_issues("psql", "")`27- `check_known_issues("mysql", "")`28- `check_known_issues("sqlite", "")`2930### 3. PostgreSQL (if db_type == postgres)31- `psql_schemas(connection="{{ source_db }}")`32- `psql_tables(connection="{{ source_db }}")`33- `psql_tables(connection="{{ target_db }}")`34- `psql_describe(connection="{{ source_db }}", table="{{ first_table }}")` — if tables35- `psql_size(connection="{{ source_db }}")`36- `psql_query(connection="{{ source_db }}", query="SELECT COUNT(*) FROM {{ first_table }}")` — if tables37- `psql_query(connection="{{ target_db }}", query="SELECT COUNT(*) FROM {{ first_table }}")` — if tables3839### 4. MySQL (if db_type == mysql)40- `mysql_tables(connection="{{ source_db }}")`41- `mysql_tables(connection="{{ target_db }}")`42- `mysql_describe(connection="{{ source_db }}", table="{{ first_table }}")` — if tables43- `mysql_show_create_table(connection="{{ source_db }}", table="{{ first_table }}")` — if tables44- `mysql_query(connection="{{ source_db }}", query="SELECT COUNT(*) FROM {{ first_table }}")` — if tables45- `mysql_query(connection="{{ target_db }}", query="SELECT COUNT(*) FROM {{ first_table }}")` — if tables4647### 5. SQLite (if db_type == sqlite)48- `sqlite_tables(database="{{ source_db }}")`49- `sqlite_tables(database="{{ target_db }}")`50- `sqlite_schema(database="{{ source_db }}")`51- `sqlite_describe(database="{{ source_db }}", table="{{ first_table }}")` — if tables52- `sqlite_query(database="{{ source_db }}", query="SELECT COUNT(*) FROM {{ first_table }}")` — if tables53- `sqlite_query(database="{{ target_db }}", query="SELECT COUNT(*) FROM {{ first_table }}")` — if tables5455### 6. Podman (optional)56- `podman_exec(container="{{ source_db }}", command="echo 'database container accessible'")` — if source is container5758### 7. Failure Learning59- "connection refused" → `learn_tool_fix("{{ db_type }}", "connection refused", "Database server not running", "Start DB or podman start <container>")`60- "does not exist" → target DB not created6162### 8. Memory63- `memory_session_log("Data migration verify", "db_type={{ db_type }}, migration={{ migration_name }}")`6465## Error Recovery6667| Error | Action |68|-------|--------|69| "connection refused" | Start database server, check connection params |70| "database does not exist" | Create target database before migration |7172## Output7374Report: schemas, source/target tables, table descriptions, row counts, database size (Postgres), CREATE TABLE (MySQL), known issues. Compare source vs target for schema/row count mismatches.7576## Chains To7778- `workflow_health_check`