Table Schema Comparator
database.compare_table_schema
Overview
You describe the table as it is and as you mean it to be — columns with their types, nullability and defaults, plus constraints and indexes — and we sort every difference into three buckets against one yardstick: whether the data already stored survives and whether the writes the old shape accepted still succeed. Conditional is its own bucket rather than a hedge: an integer becoming a float or a default being rewritten is lossy only for certain rows, and we say so instead of crying wolf or waving it through. A rename is only ever one you declare, an expression is compared as text and never evaluated, and no default value, check expression or enum member is repeated back to you.
Reviewing a table change by eye is where outages come from: the column that went NOT NULL reads like a tidy-up, and the integer that became a float reads like nothing at all. This applies one published yardstick to every difference and, where the answer honestly depends on the rows you hold, says that instead of picking a side.
Reliability
Same pair in, same buckets out, in a published order: change kind first, then path, so two runs compare byte for byte and a stored report stays diffable. A transition we publish no rule for comes back conditional with TYPE_CHANGE_UNCLASSIFIED rather than assumed safe, and where an engine is more permissive than the matrix we still say breaking. What stops the call: TABLESCHEMA_INPUT_INVALID — trigger: a side is missing, carries no columns, or an entry has the wrong shape, such as a default with kind LITERAL and no literal; retryable: no; next: fix the entry and resend. TABLESCHEMA_COLUMN_NAME_DUPLICATE — trigger: one side names the same column twice; retryable: no; next: drop the duplicate, since a comparison against it has no single answer. TABLESCHEMA_TYPE_INVALID — trigger: a parameter outside its range, such as a DECIMAL scale above its precision, or a parameter on a family that does not take it, such as length on INT32; retryable: no; next: send the parameters that family takes. TABLESCHEMA_TYPE_UNSUPPORTED — trigger: a family we do not publish, or an ARRAY of ARRAY, which nests one level only; retryable: no; next: pick a published family. TABLESCHEMA_CONSTRAINT_INVALID — trigger: an unknown kind, a CHECK with no expression, columns naming something its own side does not declare, two constraints that cannot be told apart, a second PRIMARY_KEY, or a referential property on something other than a FOREIGN_KEY; retryable: no; next: correct the constraint. TABLESCHEMA_CONSTRAINT_UNMATCHABLE — trigger: a constraint with neither a name nor columns, so whether it was dropped or renamed has no answer; retryable: no; next: give it a name or its columns. TABLESCHEMA_INDEX_INVALID — trigger: an index with no name, an unknown method, or columns its own side does not declare; retryable: no; next: correct the index. TABLESCHEMA_RENAME_INVALID — trigger: renames sent under NONE, missing under EXPLICIT, naming a column that is absent from its side or present on both, or renaming one column twice; retryable: no; next: declare each pair once against the side it belongs to. TABLESCHEMA_LIMIT_EXCEEDED — trigger: more than 1000 columns, 500 constraints or 500 indexes on a side, or more than 1000 renames; retryable: no; next: compare fewer objects per call. TABLESCHEMA_OPTION_UNSUPPORTED — trigger: a renameDetection value we do not offer; retryable: no; next: use NONE or EXPLICIT. DATABASE_CREDENTIAL_FIELD_REJECTED — trigger: a field such as password, dsn or jdbcUrl arrived anywhere in the request; retryable: no; next: remove it, because we compare declared shapes and never hold a secret.
Context footprint
Change kinds, paths and type renderings come back — never a default value, a check expression or an enum member — so a 1000-column comparison stays in the low hundreds of kilobytes. A successful call costs 2 execution credits.
When to use it
When you have the current and intended shape of a table and want to know what would break, what is safe, and what needs a look at the data first.
When you need the shape read out of a live database, the DDL written for you, or a comparison of JSON documents rather than table columns.
Scope
Non-goals
- Does not connect to a database or read a live catalog
- Does not accept or parse SQL DDL — database.sql_validate_syntax reads statements
- Does not diff JSON Schemas, which schema.diff_json_schema does against a different notion of compatibility
- Does not generate, order or apply migration statements
- Does not evaluate a default expression or a check expression
- Does not guess at a rename, and takes no dialect, because it publishes the intersection of what is safe rather than one engine's cast rules
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response may contain submitted or transformed content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| oldSchema | object | Yes | Closed previous table schema. Its properties are table, columns, and optional primaryKey and indexes. |
| newSchema | object | Yes | Closed candidate table schema. Its properties are table, columns, and optional primaryKey and indexes. |
| renameDetection | string | No | Rename-detection policy; omit it for disabled. |
| renames | array | No | Bounded optional array of explicit old/new column rename declarations; omit it when no rename should be assumed. The item shape is defined by the nested schema and the array contains from 0 through 10000 items. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| verdict | string | Yes | Overall compatibility verdict. |
| breaking | array | Yes | Bounded breaking schema changes. The item shape is defined by the nested schema and the array contains from 0 through 100000 items. |
| compatible | array | Yes | Bounded backward-compatible schema changes. The item shape is defined by the nested schema and the array contains from 0 through 100000 items. |
| conditional | array | Yes | Bounded conditionally compatible schema changes. The item shape is defined by the nested schema and the array contains from 0 through 100000 items. |
| summary | object | Yes | Closed compatibility-count summary receipt. Its documented receipt properties are bounded to 128 entries — unconstrained RFC 8259 JSON items. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"database.compare_table_schema","input":{"oldSchema":{"table":"accounts","columns":[{"name":"email","type":{"family":"VARCHAR","length":255}}]},"newSchema":{"table":"accounts","columns":[{"name":"email","type":{"family":"VARCHAR","length":255},"nullable":false}]}}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("database.compare_table_schema", {"oldSchema":{"table":"accounts","columns":[{"name":"email","type":{"family":"VARCHAR","length":255},"nullable":true},{"name":"amount","type":{"family":"DECIMAL","precision":10,"scale":2},"nullable":true}]},"newSchema":{"table":"accounts","columns":[{"name":"email","type":{"family":"VARCHAR","length":255},"nullable":false},{"name":"amount","type":{"family":"FLOAT64"},"nullable":true},{"name":"nickname","type":{"family":"VARCHAR","length":64},"nullable":true}]}});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| TABLESCHEMA_INPUT_INVALID | 400 | No | The request payload failed this skill's input validation. |
| TABLESCHEMA_COLUMN_NAME_DUPLICATE | 400 | No | The request payload failed this skill's input validation. |
| TABLESCHEMA_TYPE_INVALID | 400 | No | The request payload failed this skill's input validation. |
| TABLESCHEMA_TYPE_UNSUPPORTED | 400 | No | The skill does not support the requested variant. |
| TABLESCHEMA_CONSTRAINT_INVALID | 400 | No | The request payload failed this skill's input validation. |
| TABLESCHEMA_CONSTRAINT_UNMATCHABLE | 400 | No | The request payload failed this skill's input validation. |
| TABLESCHEMA_INDEX_INVALID | 400 | No | The request payload failed this skill's input validation. |
| TABLESCHEMA_RENAME_INVALID | 400 | No | The request payload failed this skill's input validation. |
| TABLESCHEMA_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
| TABLESCHEMA_OPTION_UNSUPPORTED | 400 | No | The skill does not support the requested variant. |
| DATABASE_CREDENTIAL_FIELD_REJECTED | 400 | No | The skill does not support the requested variant. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not connect to a database or read a live catalog
- Does not accept or parse SQL DDL — database.sql_validate_syntax reads statements
- Does not diff JSON Schemas, which schema.diff_json_schema does against a different notion of compatibility
- Does not generate, order or apply migration statements
- Does not evaluate a default expression or a check expression
- Does not guess at a rename, and takes no dialect, because it publishes the intersection of what is safe rather than one engine's cast rules
- Reading the current shape of a live table
- Turning the difference into the DDL that would apply it
- Comparing JSON payload schemas rather than table columns
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "database.compare_table_schema",
"input": {
"oldSchema": {
"table": "accounts",
"columns": [
{
"name": "email",
"type": {
"family": "VARCHAR",
"length": 255
},
"nullable": true
},
{
"name": "amount",
"type": {
"family": "DECIMAL",
"precision": 10,
"scale": 2
},
"nullable": true
}
]
},
"newSchema": {
"table": "accounts",
"columns": [
{
"name": "email",
"type": {
"family": "VARCHAR",
"length": 255
},
"nullable": false
},
{
"name": "amount",
"type": {
"family": "FLOAT64"
},
"nullable": true
},
{
"name": "nickname",
"type": {
"family": "VARCHAR",
"length": 64
},
"nullable": true
}
]
}
}
}Examples
A tightened column, a widened type and an added column, sorted three ways
{
"oldSchema": {
"table": "accounts",
"columns": [
{
"name": "email",
"type": {
"family": "VARCHAR",
"length": 255
},
"nullable": true
},
{
"name": "amount",
"type": {
"family": "DECIMAL",
"precision": 10,
"scale": 2
},
"nullable": true
}
]
},
"newSchema": {
"table": "accounts",
"columns": [
{
"name": "email",
"type": {
"family": "VARCHAR",
"length": 255
},
"nullable": false
},
{
"name": "amount",
"type": {
"family": "FLOAT64"
},
"nullable": true
},
{
"name": "nickname",
"type": {
"family": "VARCHAR",
"length": 64
},
"nullable": true
}
]
}
}{
"summary": {
"verdict": "BREAKING",
"breakingCount": 1,
"compatibleCount": 1,
"conditionalCount": 1,
"oldColumnCount": 2,
"newColumnCount": 3,
"matchedColumnCount": 2,
"renameDetection": "NONE"
},
"conditional": [
{
"changeKind": "COLUMN_TYPE_CHANGED",
"path": "/columns/amount",
"from": "DECIMAL(10,2)",
"to": "FLOAT64",
"reasonCode": "REPRESENTATION_NOT_NESTED",
"noteCodes": []
}
],
"compatible": [
{
"changeKind": "COLUMN_ADDED_NULLABLE",
"path": "/columns/nickname",
"noteCodes": []
}
],
"verdict": "BREAKING",
"breaking": [
{
"changeKind": "COLUMN_NULLABILITY_TIGHTENED",
"path": "/columns/email",
"noteCodes": []
}
]
}A declared rename beside a widening of the same column's precision
{
"renames": [
{
"from": "total",
"to": "amount_total"
}
],
"renameDetection": "EXPLICIT",
"oldSchema": {
"table": "orders",
"columns": [
{
"name": "id",
"type": {
"family": "INT32"
},
"nullable": false
},
{
"name": "total",
"type": {
"family": "DECIMAL",
"precision": 10,
"scale": 2
},
"nullable": false
}
]
},
"newSchema": {
"table": "orders",
"columns": [
{
"name": "id",
"type": {
"family": "INT64"
},
"nullable": false
},
{
"name": "amount_total",
"type": {
"family": "DECIMAL",
"precision": 12,
"scale": 2
},
"nullable": false
}
]
}
}{
"summary": {
"verdict": "BREAKING",
"breakingCount": 1,
"compatibleCount": 2,
"conditionalCount": 0,
"oldColumnCount": 2,
"newColumnCount": 2,
"matchedColumnCount": 2,
"renameDetection": "EXPLICIT"
},
"conditional": [],
"compatible": [
{
"changeKind": "COLUMN_TYPE_CHANGED",
"path": "/columns/amount_total",
"from": "DECIMAL(10,2)",
"to": "DECIMAL(12,2)",
"noteCodes": []
},
{
"changeKind": "COLUMN_TYPE_CHANGED",
"path": "/columns/id",
"from": "INT32",
"to": "INT64",
"noteCodes": []
}
],
"verdict": "BREAKING",
"breaking": [
{
"changeKind": "COLUMN_RENAMED",
"path": "/columns/total",
"noteCodes": []
}
]
}Recommended use cases
- Gate a release on whether a table change can break its readers or writers
- Review a column type change before it reaches a table with rows in it
- Show which differences are merely conditional so a reviewer looks at those
Avoid for
- Reading the current shape of a live table
- Turning the difference into the DDL that would apply it
- Comparing JSON payload schemas rather than table columns
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.