
CREATE TABLE IF NOT EXISTS `configuration` (
	`key` VARCHAR(32) PRIMARY KEY,
	`value` VARCHAR(512) NOT NULL
);

CREATE TABLE IF NOT EXISTS `game_alias` (
	id INTEGER PRIMARY KEY,
	alias VARCHAR(32) UNIQUE NOT NULL,
	`name` VARCHAR(256) NOT NULL
);

CREATE TABLE IF NOT EXISTS `game_bundle` (
	url VARCHAR(2048) PRIMARY KEY,
	name VARCHAR(256) NOT NULL,
	json VARCHAR(2048) NOT NULL
);

CREATE TABLE IF NOT EXISTS `humeur` (
	id INTEGER PRIMARY KEY AUTOINCREMENT,
	`enable` BOOLEAN NOT NULL DEFAULT TRUE,
	`text` VARCHAR(256) NULL
);

CREATE TABLE IF NOT EXISTS live_alert (
	id INTEGER PRIMARY KEY AUTOINCREMENT,
	`enable` BOOLEAN NOT NULL DEFAULT TRUE,
	`online` BOOLEAN NOT NULL DEFAULT FALSE,
	`login` VARCHAR(128) UNIQUE NOT NULL,
	`notify_channel` INTEGER NOT NULL,
	`message` VARCHAR(2000) NOT NULL
);

CREATE TABLE IF NOT EXISTS `message` (
	id INTEGER PRIMARY KEY AUTOINCREMENT,
	`enable` BOOLEAN NOT NULL DEFAULT FALSE,
	`text` VARCHAR(256) NULL,
	periodicity INTEGER NULL
);

CREATE TABLE IF NOT EXISTS `commande` (
	id INTEGER PRIMARY KEY AUTOINCREMENT,
	`discord_enable` BOOLEAN NOT NULL DEFAULT TRUE,
	`twitch_enable` BOOLEAN NOT NULL DEFAULT TRUE,
	`trigger` VARCHAR(16) UNIQUE NOT NULL,
	`response` VARCHAR(2000) NOT NULL
);

CREATE TABLE IF NOT EXISTS `moderation_event` (
	id INTEGER PRIMARY KEY AUTOINCREMENT,
	`type` VARCHAR(32) NOT NULL,
	`username` VARCHAR(256) NOT NULL,
	`discord_id` VARCHAR(64) NOT NULL,
	`created_at` DATETIME NOT NULL,
	`reason` VARCHAR(1024) NOT NULL,
	`staff_id` VARCHAR(64) NOT NULL,
	`staff_name` VARCHAR(256) NOT NULL,
	`duration` INTEGER NULL
);

CREATE TABLE IF NOT EXISTS `anticheat_cache` (
	steam_id VARCHAR(32) PRIMARY KEY,
	game_name VARCHAR(256) NOT NULL,
	status VARCHAR(32) NOT NULL,
	anticheats VARCHAR(512),
	reference VARCHAR(512),
	notes VARCHAR(1024),
	updated_at DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS `member_invites` (
	id INTEGER PRIMARY KEY AUTOINCREMENT,
	`user_id` VARCHAR(64) NOT NULL,
	`guild_id` VARCHAR(64) NOT NULL,
	`invite_code` VARCHAR(256),
	`inviter_name` VARCHAR(256),
	`join_date` DATETIME NOT NULL
);
