-- Remove fields that will be part of the json 
ALTER TABLE "COMPUTED_VALUES" DROP COLUMN COMPUTED_VERIF_CARD_KEYS;
ALTER TABLE "COMPUTED_VALUES" DROP COLUMN COMPUTED_BALLOT_CASTING_KEYS;
ALTER TABLE "COMPUTED_VALUES" DROP COLUMN COMPUTED_VALUES;
ALTER TABLE "COMPUTED_VALUES" DROP COLUMN ENCRYPTED_BALLOT_CASTING_KEY;

ALTER TABLE "COMPUTED_VALUES" DROP CONSTRAINT "COMPUTED_VALUES_UK1";
DROP INDEX "COMPUTED_VALUES_UK1";

ALTER TABLE "COMPUTED_VALUES" DROP COLUMN VERIFICATION_CARD_ID;
CREATE UNIQUE INDEX "COMPUTED_VALUES_UK1" ON "COMPUTED_VALUES" ("TENANT_ID", "ELECTION_EVENT_ID", "VERIFICATION_CARD_SET_ID");
ALTER TABLE "COMPUTED_VALUES" ADD CONSTRAINT "COMPUTED_VALUES_UK1" UNIQUE ("TENANT_ID", "ELECTION_EVENT_ID", "VERIFICATION_CARD_SET_ID") ENABLE;

-- Add results of a VC set as JSON field
ALTER TABLE "COMPUTED_VALUES" ADD ("JSON" CLOB NULL);
 

