Engine 1.2+ Skipping validation errors

The skippedErrors feature in Contember allows users to specify a list of errors that should be ignored during validation of a migration. This can be useful in cases where a migration became invalid due to improvements and new checks in validator, but cannot be changed, because it is already applied.

To skip errors, open a migration file producing errors and add skippedErrors field. It is an array of objects, each of which contains a code and a path field. The code field specifies the error code, and the path field specifies the path to the element in the migration that caused the error. Path field is optional.

It is important to note that only individual migrations can have skipped errors, and the final migrated state must be valid. This means that any errors that are skipped in one migration must be fixed in a later migration in order for the migration process to be successful.

Example:

{
	"skippedErrors": [
		{
			"code": "ACL_INVALID_CONDITION",
			"path": "roles.reader.entities.ContentReference.predicates.test"
		}
	],
	"formatVersion": 3,
	"modifications": [
		// Modifications here...
	]
}

In this example, the ACL_INVALID_CONDITION error will be ignored for the test predicate in the ContentReference entity for the reader role.

Adding skippedErrors to a migration that already ran does not change its checksum, so existing databases keep accepting it.

Available since 2.2

The checks of raw SQL that a migration adds cannot be skipped: view SQL (MODEL_INVALID_VIEW), partial index predicates (MODEL_INVALID_INDEX), check constraint expressions (MODEL_INVALID_CHECK) and column types (MODEL_INVALID_COLUMN_TYPE). A skippedErrors entry with one of these codes has no effect on these SQL checks; other errors reported under the same code can still be skipped. The checks run only for migrations that are not executed yet, which includes every migration when a new database is set up. If an executed migration holds such SQL, do not edit it (that changes its checksum, and existing databases refuse it): replace the SQL in a new migration and set up new databases from a migration snapshot, which is built from the final schema.

Engine 1.3+ skipUntil

In each error object, you can specify a skipUntil allowing to skip given validation until a specificed migration. This feature is useful when more migrations becomes invalid due to changes in the validator or data structure.

Example:

{
	"skippedErrors": [
		{
			"code": "ACL_INVALID_CONDITION",
			"path": "roles.reader.entities.ContentReference.predicates.test",
			/* highlight-start */
			"skipUntil": "2023-07-01-101530-abcd"
			/* highlight-end */
		}
	],
	"formatVersion": 3,
	"modifications": [
		// Modifications here...
	]
}

In the above example, the "ACL_INVALID_CONDITION" error is ignored for a specific predicate in the ContentReference entity for the reader role. Additionally, subsequent validations will be skipped until the migration 2023-07-01-101530-abcd.