wynn/migrations/001_original.sql

60 lines
1.5 KiB
MySQL
Raw Normal View History

2025-03-03 01:12:28 +00:00
create schema if not exists wynn;
create schema if not exists minecraft;
create schema if not exists discord;
create table if not exists wynn.guild_members (
2025-03-03 00:18:02 +00:00
guild_id UUID not null,
member_id UUID not null,
rank text not null,
joined_at timestamptz not null,
contributed bigint not null,
primary key (guild_id, member_id),
unique(member_id)
);
2025-03-03 01:12:28 +00:00
create table if not exists wynn.guild_info (
2025-03-03 00:18:02 +00:00
uid UUID not null,
name text not null,
prefix text not null,
xp bigint not null default 0,
level bigint,
xp_percent bigint,
territories bigint,
wars bigint,
created timestamptz,
primary key (uid)
);
2025-03-03 01:12:28 +00:00
create index if not exists wynn.guild_info_xp on wynn.guild_info (xp);
2025-03-03 00:18:02 +00:00
2025-03-03 01:12:28 +00:00
create table if not exists wynn.guild_season_results (
2025-03-03 00:18:02 +00:00
guild_id UUID not null,
season text not null,
rating bigint not null,
territories bigint not null,
primary key (guild_id, season)
);
2025-03-03 01:12:28 +00:00
create table if not exists minecraft.user (
2025-03-03 00:18:02 +00:00
uid UUID not null,
name text not null,
server text,
primary key (uid)
);
2025-03-03 01:12:28 +00:00
create table if not exists discord.guild_setting(
2025-03-03 00:18:02 +00:00
discord_guild text not null,
name text not null,
value jsonb not null,
primary key (discord_guild, name)
);
---- create above / drop below ----
drop table if exists wynn_guild_members;
drop table if exists wynn_guild_info;
drop table if exists wynn_guild_season_results;
drop table if exists minecraft_user;
drop table if exists discord_guild_setting;
2025-03-03 01:12:28 +00:00
drop schema if exists wynn cascade;
drop schema if exists minecraft cascade;
drop schema if exists discord cascade;