DROP TABLE IF EXISTS guild_events;
CREATE TABLE guild_events (
	id           INTEGER PRIMARY KEY,
	guild_id     INTEGER NOT NULL DEFAULT 0,
	event_id     INTEGER NOT NULL DEFAULT 0,
	event_date   INTEGER NOT NULL DEFAULT 0,
	event_type   INTEGER NOT NULL DEFAULT 0,
	description  TEXT NOT NULL,
	display      INTEGER NOT NULL DEFAULT 0,
	locked       INTEGER NOT NULL DEFAULT 0,
	archived     INTEGER NOT NULL DEFAULT 0,
	UNIQUE(guild_id, event_id),
	FOREIGN KEY (guild_id) REFERENCES guilds(id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE INDEX idx_guild_events_event_date ON guild_events(event_date);
