DROP TABLE IF EXISTS character_quest_progress;
CREATE TABLE character_quest_progress (
	id       INTEGER PRIMARY KEY,
	char_id  INTEGER NOT NULL DEFAULT 0,
	quest_id INTEGER NOT NULL DEFAULT 0,
	step_id  INTEGER NOT NULL DEFAULT 0,
	progress INTEGER NOT NULL DEFAULT 0,
	UNIQUE(char_id, quest_id, step_id),
	FOREIGN KEY (char_id) REFERENCES characters(id) ON DELETE CASCADE ON UPDATE CASCADE,
	FOREIGN KEY (quest_id) REFERENCES quests(quest_id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE INDEX idx_character_quest_progress_quest_id ON character_quest_progress(quest_id);
