--------------------------------------------------------
--  File created - Tuesday-July-14-2015   
--------------------------------------------------------
-- DROP TABLE "VOTER_INFORMATION";
-- DROP TABLE "CREDENTIAL_DATA";
-- DROP SEQUENCE "CREDENTIAL_DATA_SEQ";
-- DROP SEQUENCE "VOTER_INFORMATION_SEQ";
--------------------------------------------------------
--  DDL for Sequence CREDENTIAL_DATA_SEQ
--------------------------------------------------------

   CREATE SEQUENCE  "CREDENTIAL_DATA_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE  NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence VOTER_INFORMATION_SEQ
--------------------------------------------------------

   CREATE SEQUENCE  "VOTER_INFORMATION_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE  NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Table VOTER_INFORMATION
--------------------------------------------------------

  CREATE TABLE "VOTER_INFORMATION" 
   (	"ID" NUMBER(11,0), 
	"TENANT_ID" VARCHAR2(100 CHAR), 
	"ELECTION_EVENT_ID" VARCHAR2(100 CHAR), 
	"VOTING_CARD_ID" VARCHAR2(100 CHAR), 
	"BALLOT_ID" VARCHAR2(100 CHAR), 
	"CREDENTIAL_ID" VARCHAR2(100 CHAR), 
	"VERIFICATION_CARD_ID" VARCHAR2(100 CHAR), 
	"BALLOT_BOX_ID" VARCHAR2(100 CHAR), 
	"VERIFICATION_CARD_SET_ID" VARCHAR2(100 CHAR), 
	"VOTING_CARD_SET_ID" VARCHAR2(100 CHAR)
   ) ;
--------------------------------------------------------
--  DDL for Table CREDENTIAL_DATA
--------------------------------------------------------

  CREATE TABLE "CREDENTIAL_DATA" 
   (	"ID" NUMBER(11,0), 
	"CREDENTIAL_ID" VARCHAR2(100 CHAR), 
	"TENANT_ID" VARCHAR2(100 CHAR), 
	"ELECTION_EVENT_ID" VARCHAR2(100 CHAR), 
	"KEYSTORE" CLOB
   ) ;
--------------------------------------------------------
--  DDL for Index VOTER_INFORMATION_UK1
--------------------------------------------------------

  CREATE UNIQUE INDEX "VOTER_INFORMATION_UK1" ON "VOTER_INFORMATION" ("TENANT_ID", "ELECTION_EVENT_ID", "VOTING_CARD_ID") 
  ;
--------------------------------------------------------
--  DDL for Index SYS_C0010372
--------------------------------------------------------

  CREATE UNIQUE INDEX "SYS_C0010372" ON "VOTER_INFORMATION" ("ID") 
  ;
--------------------------------------------------------
--  DDL for Index SYS_C0010348
--------------------------------------------------------

  CREATE UNIQUE INDEX "SYS_C0010348" ON "CREDENTIAL_DATA" ("ID") 
  ;
--------------------------------------------------------
--  DDL for Index CREDENTIAL_DATA_UK1
--------------------------------------------------------

  CREATE UNIQUE INDEX "CREDENTIAL_DATA_UK1" ON "CREDENTIAL_DATA" ("TENANT_ID", "ELECTION_EVENT_ID", "CREDENTIAL_ID") 
  ;
--------------------------------------------------------
--  Constraints for Table VOTER_INFORMATION
--------------------------------------------------------

  ALTER TABLE "VOTER_INFORMATION" ADD CONSTRAINT "VOTER_INFORMATION_UK1" UNIQUE ("TENANT_ID", "ELECTION_EVENT_ID", "VOTING_CARD_ID") ENABLE;
  ALTER TABLE "VOTER_INFORMATION" ADD PRIMARY KEY ("ID") ENABLE;
  ALTER TABLE "VOTER_INFORMATION" MODIFY ("VOTING_CARD_SET_ID" NOT NULL ENABLE);
  ALTER TABLE "VOTER_INFORMATION" MODIFY ("VERIFICATION_CARD_SET_ID" NOT NULL ENABLE);
  ALTER TABLE "VOTER_INFORMATION" MODIFY ("BALLOT_BOX_ID" NOT NULL ENABLE);
  ALTER TABLE "VOTER_INFORMATION" MODIFY ("VERIFICATION_CARD_ID" NOT NULL ENABLE);
  ALTER TABLE "VOTER_INFORMATION" MODIFY ("CREDENTIAL_ID" NOT NULL ENABLE);
  ALTER TABLE "VOTER_INFORMATION" MODIFY ("BALLOT_ID" NOT NULL ENABLE);
  ALTER TABLE "VOTER_INFORMATION" MODIFY ("VOTING_CARD_ID" NOT NULL ENABLE);
  ALTER TABLE "VOTER_INFORMATION" MODIFY ("ELECTION_EVENT_ID" NOT NULL ENABLE);
  ALTER TABLE "VOTER_INFORMATION" MODIFY ("TENANT_ID" NOT NULL ENABLE);
  ALTER TABLE "VOTER_INFORMATION" MODIFY ("ID" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table CREDENTIAL_DATA
--------------------------------------------------------

  ALTER TABLE "CREDENTIAL_DATA" ADD CONSTRAINT "CREDENTIAL_DATA_UK1" UNIQUE ("TENANT_ID", "ELECTION_EVENT_ID", "CREDENTIAL_ID") ENABLE;
  ALTER TABLE "CREDENTIAL_DATA" ADD PRIMARY KEY ("ID") ENABLE;
  ALTER TABLE "CREDENTIAL_DATA" MODIFY ("KEYSTORE" NOT NULL ENABLE);
  ALTER TABLE "CREDENTIAL_DATA" MODIFY ("ELECTION_EVENT_ID" NOT NULL ENABLE);
  ALTER TABLE "CREDENTIAL_DATA" MODIFY ("TENANT_ID" NOT NULL ENABLE);
  ALTER TABLE "CREDENTIAL_DATA" MODIFY ("CREDENTIAL_ID" NOT NULL ENABLE);
  ALTER TABLE "CREDENTIAL_DATA" MODIFY ("ID" NOT NULL ENABLE);
