
create table "VaccineGroup"(
				"VaccineGroupId" serial primary key,
				"VaccineGroupName" text,
				"Description" text,
				"CreatedBy" int references "Account"("AccountId"),
				"CreatedDate" timestamp without time zone,
				"ModifiedBy" int references "Account"("AccountId"),
				"ModifiedDate" timestamp without time zone
);

create table "VaccineType"(
				"VaccineTypeId" serial primary key,
				"TypeName" varchar(300),
				"RowColor" varchar(250)
);


create table "VaccineMaster"(
			"VaccineMasterId" serial primary key,
			"VaccineGroupId" int references "VaccineGroup"("VaccineGroupId"),
			"VaccineName" text,
			"DisplayName" text,
			"VaccineInstruction" text,
			"Order" int,
			"VaccineTypeId" int references "VaccineType"("VaccineTypeId"),
			"AllowedDays" int,
			"AllowedYear" int,
			"AllowedMonth" int,
			"ExclusionDays" text,
			"AllowedLapsDays" int,
			"CreatedBy" int references "Account"("AccountId"),
			"CreatedDate" timestamp without time zone,
			"ModifiedBy" int references "Account"("AccountId"),
			"ModifiedDate" timestamp without time zone			
);

create table "VaccineDependency"(
				"VaccineDependencyId" serial primary key,
				"VaccineMasterId" int references "VaccineMaster"("VaccineMasterId"),
				"DependentOn" int references "VaccineMaster"("VaccineMasterId")
);


insert into "VaccineType" ("TypeName", "RowColor") 
values
('Compulsory','#ffff'),
('Additional Vaccine','#90ee90'),
('Special Vaccine','#ffc0cb');


alter table "VaccineMaster" drop column"AllowedYear",drop column"AllowedMonth" ,
add column "AllowedType" varchar(10);
