CREATE TABLE fjs_off_road_reasons (
	id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
	name VARCHAR(255) NOT NULL UNIQUE
) ENGINE=InnoDB;

INSERT INTO fjs_off_road_reasons (name) VALUES
	('Scheduled Service'),
	('Electrical Test'),
	('Mechanical Repair'),
	('Accident Repair'),
	('Breakdown'),
	('Modification');

CREATE TABLE fjs_work_order_day_entries (
	work_order_id INT NOT NULL,
	entry_date DATE NOT NULL,
	off_road_reason_id INT NOT NULL,
	PRIMARY KEY (work_order_id, entry_date),
	INDEX idx_work_order_id (work_order_id),
	INDEX idx_entry_date (entry_date),
	INDEX idx_off_road_reason_id (off_road_reason_id),
	FOREIGN KEY fk_off_road_reason (off_road_reason_id) REFERENCES fjs_off_road_reasons (id)
) ENGINE=InnoDB;
