Skip to content
Snippets Groups Projects
Commit 0bf326d7 authored by tpylak's avatar tpylak
Browse files

LMS-586 add "if exists" check to fix bub in db migration to v023

SVN: 8315
parent 0873c0dc
No related branches found
No related tags found
No related merge requests found
-- JAVA ch.systemsx.cisd.lims.server.dataaccess.migration.MigrationStepFrom025To026
-- Remove ID column from SAMPLE_INPUTS table
DROP SEQUENCE SAMPLE_INPUT_ID_SEQ;
ALTER TABLE SAMPLE_INPUTS DROP CONSTRAINT SAIN_PK;
-- There was a bug in migration to db 23 - the constraint was not created. So we drop it only if it exists.
create function remove_sain_pk_constraint() returns void AS $$
begin
perform *
FROM information_schema.table_constraints WHERE constraint_name='sain_pk';
if found
then
ALTER TABLE SAMPLE_INPUTS DROP CONSTRAINT SAIN_PK;
end if;
end;
$$ language 'plpgsql';
select remove_sain_pk_constraint();
drop function remove_sain_pk_constraint();
ALTER TABLE SAMPLE_INPUTS DROP COLUMN ID;
ALTER TABLE SAMPLE_INPUTS ADD CONSTRAINT SAIN_PK PRIMARY KEY(SAMP_ID,PROC_ID);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment