π SQL
If prescriptions are enabled in Config.Prescriptions then you must ensure you import or run the SQL file provided in [SQL] to your database in order for the prescriptions to work as intended
CREATE TABLE IF NOT EXISTS `lusty94_pharmacy_prescriptions` (
`id` INT NOT NULL AUTO_INCREMENT,
`patient_cid` VARCHAR(64) NOT NULL,
`patient_name` VARCHAR(128) NOT NULL,
`issued_by_cid` VARCHAR(64) NOT NULL,
`issued_by_name` VARCHAR(128) NOT NULL,
`issued_job` VARCHAR(64) NOT NULL,
`start_date` DATE NOT NULL,
`duration_days` INT NOT NULL,
`expires_at` DATE NOT NULL,
`active` TINYINT(1) NOT NULL DEFAULT 1,
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_patient_active` (`patient_cid`, `active`),
KEY `idx_expires` (`expires_at`)
);
CREATE TABLE IF NOT EXISTS `lusty94_pharmacy_prescription_items` (
`id` INT NOT NULL AUTO_INCREMENT,
`prescription_id` INT NOT NULL,
`item_name` VARCHAR(64) NOT NULL,
`item_label` VARCHAR(128) NOT NULL,
`per_day` INT NOT NULL DEFAULT 1,
`claimed_today` INT NOT NULL DEFAULT 0,
`last_claim_date` DATE NULL,
PRIMARY KEY (`id`),
KEY `idx_prescription` (`prescription_id`),
CONSTRAINT `fk_prescription_items_prescription`
FOREIGN KEY (`prescription_id`) REFERENCES `lusty94_pharmacy_prescriptions`(`id`)
ON DELETE CASCADE
);
Last updated