DROP TABLE IF EXISTS character_aa;
CREATE TABLE character_aa (
	id          INTEGER PRIMARY KEY,
	char_id     INTEGER NOT NULL,
	template_id INTEGER NOT NULL,
	tab_id      INTEGER NOT NULL,
	aa_id       INTEGER NOT NULL,
	order       INTEGER NOT NULL,
	treeid      INTEGER NOT NULL,
	FOREIGN KEY (char_id) REFERENCES characters(id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE INDEX idx_character_aa_char_id ON character_aa(char_id);
