-- Add migration script here
create TABLE `Guild` (
    `id` INT UNSIGNED NOT NULL PRIMARY KEY
);

create TABLE `User` (
    `id` INT UNSIGNED NOT NULL PRIMARY KEY
);

create TABLE `Channel` (
    `id` INT UNSIGNED NOT NULL PRIMARY KEY,
    `guild_id` INT UNSIGNED NOT NULL,
    FOREIGN KEY(guild_id) REFERENCES Guild(id)
);

create TABLE `Logs` (
    `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    `guild_id` INT UNSIGNED NOT NULL,
    `channel_id` INT UNSIGNED NOT NULL,
    `message_create` BOOLEAN DEFAULT FALSE,
    `message_update` BOOLEAN DEFAULT FALSE,
    `message_delete` BOOLEAN DEFAULT FALSE,
    `voice_join` BOOLEAN DEFAULT FALSE,
    `voice_quit` BOOLEAN DEFAULT FALSE,
    FOREIGN KEY(guild_id) REFERENCES Guild(id),
    FOREIGN KEY(channel_id) REFERENCES Channel(id)
);

create TABLE `Auto_Channel` (
    `channel_id` INT UNSIGNED NOT NULL PRIMARY KEY,
    `category_id` INT UNSIGNED,
    FOREIGN KEY(channel_id) REFERENCES User(id)
)
