Check for and resolve schema changes
Before you start a data generation job, we recommend that you check for and resolve any schema changes on the source database.
In the Tonic Structural application, you can use the Schema Changes view to review and resolve any changes.
From the API, you can:
Retrieve a list of schema changes
Resolve schema changes
Retrieve the list of schema changes
To view the list of schema changes, use GET /api/SchemaDiff.
In the results, each schema change uses the following format:
{
"schemaName": "string",
"tableName": "string",
"issueCode": "string",
"columnName": "string",
"pathName": "string",
"oldDataType": "string",
"newDataType": "string"
}
Where:
schemaName
The name of the affected schema.
tableName
The name of the affected table.
For MongoDB, this is the name of the affected collection.
issueCode
The type of schema change. Possible values are:
new_column
- The column was added to the table.changed_column_type
- The column data type changed. Data type changes are only listed if the change introduces a conflict in the workspace configuration.new_table
- The table was added to the schema.missing_column
- The column was removed from the table. Removed columns are only listed if the removal introduces a conflict in the workspace configuration.missing_table
- The table was removed from the schema. Removed tables are only listed if the removal introduces a conflict in the workspace configuration.changed_nullability
- The column changed whether it can be NULL. Nullability changes are only listed if the change introduces a conflict in the workspace configuration.new_foreign_key
- The column had an assigned generator, but is now a foreign key. Foreign keys must inherit the generator from the primary key.new_collection
- For MongoDB and Amazon DynamoDB only. The collection was added to the source database.missing_collection
- For MongoDB and Amazon DynamoDB only. The collection was removed from the source database. Removed collections are only listed if the change introduces a conflict in the workspace configuration.new_path_type
- For MongoDB, Amazon DynamoDB, and JSON fields only. The column has a new path type.missing_path_type
- For MongoDB, Amazon DynamoDB, and JSON fields only. The column path type was removed.
columnName
The name of the affected column. For new or removed tables or collections, there is no column name.
pathName
The affected path. For JSON fields only, for new_path_type
and missing_path_type
issues.
oldDataType
For columns that change type, the previous data type.
newDataType
For a new column, the data type of the column. For columns that change type, the new data type.
Resolve selected schema changes
You can use the API to resolve specified schema changes.
When you use the API to resolve schema changes:
For information on how Structural resolves sensitive schema changes (new tables and columns), go to Addressing sensitive schema changes.
For information on how Structural resolves notifications (removed tables and columns), go to Dismissing notification schema changes.
To resolve a single schema change, use POST /api/SchemaDiff/resolve. The request body provides the details for a single schema change.
To resolve multiple changes, use POST /api/SchemaDiff/resolve_multiple. The request body provides the details for each schema change.
In the request body, each schema change has the following format:
{
"workspaceId": "string",
"issueCode": "new_column",
"schemaName": "string",
"tableName": "string",
"columnName": "string",
"pathName": "string",
"dataType": "string"
}
Where:
workspaceId
The identifier of the workspace.
issueCode
The type of issue.
schemaName
The name of the affected schema.
tableName
The name of the affected table.
columnName
The name of the affected column. Only provided for column-specific issues.
pathName
For JSON fields only. The affected path. Provided for path-specific issues.
dataType
For MongoDB, Amazon DynamoDB, and JSON fields only. The data type for the affected column.
Resolving all schema changes for a workspace
To resolve all schema changes for a workspace, use:
POST /api/SchemaDiff/{workspaceId}/resolve_all
The resolutionOption
parameter identifies the types of schema changes to resolve. The options are:
All
- Indicates to resolve all of the schema changes.Actions
- Indicates to only resolve sensitive schema changes.Notifications
- Indicates to only resolve notifications.
Last updated
Was this helpful?