DROP TABLE IF EXISTS dialog_responses;
CREATE TABLE dialog_responses (
	id               INTEGER PRIMARY KEY,
	parent_dialog_id INTEGER NOT NULL,
	index            INTEGER NOT NULL,
	text_id          INTEGER NOT NULL,
	next_dialog_id   INTEGER,
	FOREIGN KEY (parent_dialog_id) REFERENCES dialogs(id) ON UPDATE CASCADE,
	FOREIGN KEY (next_dialog_id) REFERENCES dialogs(id) ON UPDATE CASCADE,
	FOREIGN KEY (text_id) REFERENCES dialog_text(id) ON UPDATE CASCADE
);
CREATE INDEX idx_dialog_responses_parent_dialog_id ON dialog_responses(parent_dialog_id);
CREATE INDEX idx_dialog_responses_text_id ON dialog_responses(text_id);
CREATE INDEX idx_dialog_responses_next_dialog_id ON dialog_responses(next_dialog_id);
