forked from gorb/backend
feat: use diesel-cli instead of hand writing tables
after reading the documentation, crazy right? I figured out i was making my life hard, this makes my life easy again
This commit is contained in:
parent
f1d5b4316e
commit
a6d35b0ba2
24 changed files with 323 additions and 206 deletions
3
migrations/2025-05-21-193620_create_roles/down.sql
Normal file
3
migrations/2025-05-21-193620_create_roles/down.sql
Normal file
|
@ -0,0 +1,3 @@
|
|||
-- This file should undo anything in `up.sql`
|
||||
DROP TABLE role_members;
|
||||
DROP TABLE roles;
|
15
migrations/2025-05-21-193620_create_roles/up.sql
Normal file
15
migrations/2025-05-21-193620_create_roles/up.sql
Normal file
|
@ -0,0 +1,15 @@
|
|||
-- Your SQL goes here
|
||||
CREATE TABLE roles (
|
||||
uuid uuid UNIQUE NOT NULL,
|
||||
guild_uuid uuid NOT NULL REFERENCES guilds(uuid) ON DELETE CASCADE,
|
||||
name VARCHAR(50) NOT NULL,
|
||||
color int NOT NULL DEFAULT 16777215,
|
||||
position int NOT NULL,
|
||||
permissions int8 NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (uuid, guild_uuid)
|
||||
);
|
||||
CREATE TABLE role_members (
|
||||
role_uuid uuid NOT NULL REFERENCES roles(uuid) ON DELETE CASCADE,
|
||||
member_uuid uuid NOT NULL REFERENCES guild_members(uuid) ON DELETE CASCADE,
|
||||
PRIMARY KEY (role_uuid, member_uuid)
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue