Skip to main content
Version: V3 (Ignition 8.3)

Release notes

Unreleased: OEE location integrity​

This update adds database foreign keys from OEE configurations, modes, states and state interruption locations to the location table. Once installed, these constraints prevent deleting or changing the ID of a location while those OEE settings still reference it. Interruption locations remain optional.

Existing orphaned references​

An older database may already contain an OEE setting whose location no longer exists. The migration defers only the affected foreign key and continues with the other constraints and later database migrations. It leaves that changeset pending and retries it on the next module restart. It does not delete, reassign or disable any OEE data.

The gateway log identifies the skipped constraint and includes a read-only query returning the affected setting IDs, missing location IDs and enabled flags. A constraint that already exists is also skipped; if the query returns no rows, that existing constraint needs no orphan repair.

This change does not recover OEE startup when enabled settings already reference a missing location. It also checks disabled settings: disabling an orphan does not repair the reference, and the affected table remains without its new constraint until the data is repaired.

Find and repair affected settings​

Run this read-only query against the MES database. It works on MariaDB, MySQL, PostgreSQL and SQL Server and includes disabled settings.

SELECT 'oee_configurations' AS source_table, 'location_id' AS source_column,
c.id AS row_id, c.location_id AS missing_location_id, c.enabled
FROM oee_configurations c
WHERE NOT EXISTS (SELECT 1 FROM locations l WHERE l.id = c.location_id)
UNION ALL
SELECT 'oee_modes', 'location_id', m.id, m.location_id, m.enabled
FROM oee_modes m
WHERE NOT EXISTS (SELECT 1 FROM locations l WHERE l.id = m.location_id)
UNION ALL
SELECT 'oee_states', 'location_id', s.id, s.location_id, s.enabled
FROM oee_states s
WHERE NOT EXISTS (SELECT 1 FROM locations l WHERE l.id = s.location_id)
UNION ALL
SELECT 'oee_states', 'interruption_location_id', s.id,
s.interruption_location_id, s.enabled
FROM oee_states s
WHERE s.interruption_location_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM locations l WHERE l.id = s.interruption_location_id);
  1. Use source_table, source_column and row_id to identify each affected setting. Restore the correct missing location with its original ID from a trusted backup, or explicitly correct the reference to the intended existing location. Do not choose an arbitrary location merely to satisfy the constraint. An interruption reference may be cleared to NULL only when that interruption location is no longer intended; the primary location references are required.
  2. Rerun the query until it returns no rows. No automatic repair SQL is provided because the correct location depends on the site's configuration.
  3. Restart the Tamaki MES module to retry pending constraints. On a redundant pair, migrations run on the active gateway. Do not manually mark the deferred changesets as executed in DATABASECHANGELOG.
  4. Verify that the four constraints below exist in the MES schema. If a constraint is still absent, inspect the gateway migration log for its diagnostic query or database error.
SELECT TABLE_SCHEMA, TABLE_NAME, CONSTRAINT_NAME
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE CONSTRAINT_TYPE = 'FOREIGN KEY'
AND CONSTRAINT_NAME IN (
'fk_oee_configuration_location',
'fk_oee_mode_location',
'fk_oee_state_location',
'fk_oee_state_interruption_location'
);

Expect four rows for the MES schema. The same changeset IDs are used on release/2 and release/3, so switching release lines does not reinstall constraints that have already been applied.