DROP TABLE IF EXISTS guild_ranks;
CREATE TABLE guild_ranks (
	id          INTEGER PRIMARY KEY,
	guild_id    INTEGER NOT NULL DEFAULT 0,
	rank_id     INTEGER NOT NULL DEFAULT 0,
	rank_name   TEXT NOT NULL,
	permission1 INTEGER NOT NULL DEFAULT 0,
	permission2 INTEGER NOT NULL DEFAULT 0,
	UNIQUE(guild_id, rank_id),
	FOREIGN KEY (guild_id) REFERENCES guilds(id) ON DELETE CASCADE ON UPDATE CASCADE
);
