create table "PatientMedicationHeader"(
		"PatientMedicationHeaderId" serial primary key,"AppointmentId" int references "Appointment"("AppointmentId"),	
		"CreatedBy" int references "Account"("AccountId"),"CreatedDate" timestamp without time zone,
		"ModifiedBy" int references "Account"("AccountId"),"ModifiedDate" timestamp without time zone,
		"Active" boolean default true);
		
create table "PatientMedicationDetail"(
		"PatientMedicationDetailId" serial primary key,"PatientMedicationHeaderId" int references "PatientMedicationHeader"("PatientMedicationHeaderId"),
		"PharmacyProductId" int references "PharmacyProduct"("PharmacyProductId"),"Duration" int not null,
		"DurationType" varchar(10) not null,"IsMorning" boolean default false,"IsAfternoon" boolean default false,"IsNight" boolean default false,
		"MorningDosage" text,"AfternoonDosage" text,"NightDosage" text
);
-----------------

alter table "PatientMedicationHeader" add column "EncounterType" text;

--------------

alter table "PatientMedicationDetail" add column "Dosage" int not null;

alter table "PatientMedicationDetail" add column "Instruction" text;