From 7c2e1abbc368c6929507309e9dbf80e24287d964 Mon Sep 17 00:00:00 2001 From: shockrah Date: Wed, 11 Mar 2020 00:39:10 -0700 Subject: [PATCH] new channel schema which is meant to encompass both text and voice channels --- server/migrations/2020-03-11-005217_channels/up.sql | 2 ++ server/src/models.rs | 6 ++++++ server/src/schema.rs | 3 +++ 3 files changed, 11 insertions(+) diff --git a/server/migrations/2020-03-11-005217_channels/up.sql b/server/migrations/2020-03-11-005217_channels/up.sql index 72d319d..196f733 100644 --- a/server/migrations/2020-03-11-005217_channels/up.sql +++ b/server/migrations/2020-03-11-005217_channels/up.sql @@ -3,5 +3,7 @@ CREATE TABLE IF NOT EXISTS `channels` ( `id` INTEGER NOT NULL auto_increment, `name` VARCHAR(255) NOT NULL, `permissions` INTEGER NOT NULL, + `limit` INTEGER NOT NULL, + `type` INTEGER NOT NULL, PRIMARY KEY(`id`) ); \ No newline at end of file diff --git a/server/src/models.rs b/server/src/models.rs index 7691edc..b9f0e74 100644 --- a/server/src/models.rs +++ b/server/src/models.rs @@ -16,10 +16,16 @@ pub struct User { pub date: u64, } +// These are to be use specifically for discerning between channel types +pub const VOICE_CHANNEL: i32 = 1; +pub const TEXT_CHANNEL: i32 = 2; + #[derive(Serialize, Deserialize, Queryable, Insertable)] #[table_name = "channels" ] pub struct Channel { pub id: i32, pub name: String, pub permissions: i32, + pub limit: i32, // <= 0 means there is no limit + pub type_: i32, // 1 for voice 2 for text } \ No newline at end of file diff --git a/server/src/schema.rs b/server/src/schema.rs index 917fd49..58b6e9c 100644 --- a/server/src/schema.rs +++ b/server/src/schema.rs @@ -3,6 +3,9 @@ table! { id -> Integer, name -> Varchar, permissions -> Integer, + limit -> Integer, + #[sql_name = "type"] + type_ -> Integer, } }