-- JAVA ch.systemsx.cisd.openbis.generic.server.dataaccess.migration.MigrationStepFrom025To026\012-- Remove ID column from SAMPLE_INPUTS table\012DROP SEQUENCE SAMPLE_INPUT_ID_SEQ;\012-- There was a bug in migration to db 23 - the constraint was not created. So we drop it only if it exists.\012create function remove_sain_pk_constraint() returns void AS $$\012begin\012   perform *\012     FROM information_schema.table_constraints WHERE constraint_name='sain_pk';\012   if found\012   then\012\011ALTER TABLE SAMPLE_INPUTS DROP CONSTRAINT SAIN_PK;\012   end if;\012end;\012$$ language 'plpgsql';\012select remove_sain_pk_constraint();\012drop function remove_sain_pk_constraint();\012ALTER TABLE SAMPLE_INPUTS DROP COLUMN ID;\012ALTER TABLE SAMPLE_INPUTS ADD CONSTRAINT SAIN_PK PRIMARY KEY(SAMP_ID,PROC_ID);\012\012-- Remove ID column from SAMPLE_MATERIAL_BATCHES table\012DROP SEQUENCE SAMPLE_MATERIAL_BATCH_ID_SEQ;\012-- There was a bug in migration to db 23 - the constraint was not created. So we drop it only if it exists.\012create function remove_samb_pk_constraint() returns void AS $$\012begin\012   perform *\012     FROM information_schema.table_constraints WHERE constraint_name='SAMB_PK';\012   if found\012   then\012\011\011\011ALTER TABLE SAMPLE_MATERIAL_BATCHES DROP CONSTRAINT SAMB_PK;\012   end if;\012end;\012$$ language 'plpgsql';\012select remove_samb_pk_constraint();\012drop function remove_samb_pk_constraint();\012ALTER TABLE SAMPLE_MATERIAL_BATCHES DROP COLUMN ID;\012ALTER TABLE SAMPLE_MATERIAL_BATCHES ADD CONSTRAINT SAMB_PK PRIMARY KEY(SAMP_ID,MABA_ID);\012\012-- Remove ID and REGISTRATION_TIMESTAMP column from DATA_SET_RELATIONSHIPS table\012DROP SEQUENCE DATA_SET_RELATIONSHIP_ID_SEQ;\012ALTER TABLE DATA_SET_RELATIONSHIPS DROP CONSTRAINT DSRE_PK;\012ALTER TABLE DATA_SET_RELATIONSHIPS DROP CONSTRAINT DSRE_BK_UK;\012ALTER TABLE DATA_SET_RELATIONSHIPS DROP COLUMN ID;\012ALTER TABLE DATA_SET_RELATIONSHIPS DROP COLUMN REGISTRATION_TIMESTAMP;\012ALTER TABLE DATA_SET_RELATIONSHIPS ADD CONSTRAINT DSRE_PK PRIMARY KEY(DATA_ID_PARENT,DATA_ID_CHILD);\012\012-- Rename: \012-- OBSERVABLE_TYPES -> DATA_SET_TYPES\012-- OBSERVABLE_TYPE_ID_SEQ -> DATA_SET_TYPE_ID_SEQ\012-- DATA.OBTY_ID -> DATA.DSTY_ID\012ALTER TABLE OBSERVABLE_TYPES RENAME TO DATA_SET_TYPES;\012ALTER TABLE OBSERVABLE_TYPE_ID_SEQ RENAME TO DATA_SET_TYPE_ID_SEQ;\012ALTER TABLE DATA RENAME COLUMN OBTY_ID TO DSTY_ID;\012