DROP TABLE IF EXISTS dialog_play_voices;
CREATE TABLE dialog_play_voices (
	id               INTEGER PRIMARY KEY,
	npc_id           INTEGER NOT NULL,
	voiceover_id     INTEGER NOT NULL,
	language         INTEGER NOT NULL,
	garbled_text_id  INTEGER,
	log_id           INTEGER NOT NULL,
	UNIQUE(npc_id, voiceover_id, garbled_text_id),
	FOREIGN KEY (npc_id) REFERENCES dialog_npcs(id) ON UPDATE CASCADE,
	FOREIGN KEY (voiceover_id) REFERENCES dialog_voiceovers(id) ON UPDATE CASCADE,
	FOREIGN KEY (garbled_text_id) REFERENCES dialog_text(id) ON UPDATE CASCADE
);
CREATE INDEX idx_dialog_play_voices_voiceover_id ON dialog_play_voices(voiceover_id);
CREATE INDEX idx_dialog_play_voices_garbled_text_id ON dialog_play_voices(garbled_text_id);
