CREATE TABLE messages (
	id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
	location_id INT NOT NULL,
	message_date DATE NOT NULL,
	message VARCHAR(255) NOT NULL,
	FOREIGN KEY idx_location_id (location_id) REFERENCES locations (id) ON DELETE CASCADE,
	UNIQUE KEY (location_id, message_date)
) ENGINE=InnoDB;

CREATE TABLE message_defaults (
	location_id INT NOT NULL PRIMARY KEY,
	message VARCHAR(255) NOT NULL,
	FOREIGN KEY idx_location_id (location_id) REFERENCES locations (id) ON DELETE CASCADE
) ENGINE=InnoDB;