DROP TABLE IF EXISTS character_collections;
CREATE TABLE character_collections (
	id            INTEGER PRIMARY KEY,
	char_id       INTEGER NOT NULL,
	collection_id INTEGER NOT NULL,
	completed     INTEGER NOT NULL DEFAULT 0,
	UNIQUE(char_id, collection_id),
	FOREIGN KEY (char_id) REFERENCES characters(id) ON DELETE CASCADE ON UPDATE CASCADE,
	FOREIGN KEY (collection_id) REFERENCES collections(id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE INDEX idx_character_collections_collection_id ON character_collections(collection_id);
