-- Migration from 104 to 105
ALTER DOMAIN DATA_STORE_SERVICE_REPORTING_PLUGIN_TYPE DROP CONSTRAINT DATA_STORE_SERVICE_REPORTING_PLUGIN_TYPE_CHECK;
ALTER DOMAIN DATA_STORE_SERVICE_REPORTING_PLUGIN_TYPE ADD CONSTRAINT DATA_STORE_SERVICE_REPORTING_PLUGIN_TYPE_CHECK CHECK (VALUE IN ('TABLE_MODEL', 'DSS_LINK', 'AGGREGATION_TABLE_MODEL'));

CREATE TABLE ENTITY_OPERATIONS_LOG (ID TECH_ID NOT NULL, REGISTRATION_ID TECH_ID NOT NULL);
CREATE SEQUENCE ENTITY_OPERATIONS_LOG_ID_SEQ;
ALTER TABLE ENTITY_OPERATIONS_LOG ADD CONSTRAINT EOL_PK PRIMARY KEY(ID);
ALTER TABLE ENTITY_OPERATIONS_LOG ADD CONSTRAINT EOL_REG_ID_UK UNIQUE(REGISTRATION_ID);
CREATE INDEX ENTITY_OPERATIONS_LOG_RID_I ON ENTITY_OPERATIONS_LOG(REGISTRATION_ID);
GRANT SELECT ON SEQUENCE ENTITY_OPERATIONS_LOG_ID_SEQ TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE ENTITY_OPERATIONS_LOG TO GROUP OPENBIS_READONLY;