From 88e1b886e5471552c055374f71d848d3a3dcb4b6 Mon Sep 17 00:00:00 2001
From: Anhgelus Morhtuuzh <william@herges.fr>
Date: Thu, 5 Mar 2026 12:21:04 +0100
Subject: feat(db): connect with sql instead of gorm

---
 migrations/000-leave-gorm.sql | 44 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 migrations/000-leave-gorm.sql

(limited to 'migrations/000-leave-gorm.sql')

diff --git a/migrations/000-leave-gorm.sql b/migrations/000-leave-gorm.sql
new file mode 100644
index 0000000..91addd8
--- /dev/null
+++ b/migrations/000-leave-gorm.sql
@@ -0,0 +1,44 @@
+CREATE DOMAIN snowflake AS NUMERIC(20,0) CHECK (VALUE < 36893488147419103232 and CHECK VALUE > 0);
+CREATE DOMAIN uint AS INTEGER CHECK (VALUE >= 0);
+
+CREATE TABLE IF NOT EXISTS guilds (
+    id snowflake PRIMARY KEY,
+    disabled_channels TEXT,
+    fallback_channel snowflake,
+    days_xp_remains INTEGER CHECK (VALUE > 0) DEFAULT 90
+);
+
+CREATE TABLE IF NOT EXISTS copaings (
+    id snowflake PRIMARY KEY,
+    guild_id snowflake REFERENCES guilds(id) NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS copaing_xps (
+    copaing_id snowflake REFERENCES copaings(id) NOT NULL,
+    guild_id snowflake REFERENCES copaings(id) NOT NULL,
+    xp uint DEFAULT 0,
+    created_at TIMESTAMP DEFAULT NOW,
+    PRIMARY KEY(copaing_id, guild_id, created_at)
+);
+
+CREATE TABLE IF NOT EXISTS xp_roles (
+    xp uint,
+    role snowflake,
+    guild_id snowflake REFERENCES guilds(id),
+    PRIMARY KEY(xp, role, guild_id)
+);
+
+CREATE TABLE IF NOT EXISTS role_react_messages (
+    id SERIAL PRIMARY KEY,
+    message_id snowflake,
+    channel_id snowflake,
+    guild_id snowflake REFERENCES guilds(id),
+    note TEXT
+);
+
+CREATE TABLE IF NOT EXISTS role_reacts (
+    role snowflake,
+    message_id snowflake REFERENCES role_react_messages(id),
+    reaction TEXT,
+    PRIMARY KEY(role, message_id, reaction)
+);
-- 
cgit v1.2.3

