From 924c15a43619aba8f9cf3369c715f1019c0eab3e Mon Sep 17 00:00:00 2001 From: shockrah Date: Mon, 9 Mar 2020 00:52:09 -0700 Subject: [PATCH] No more nullable uses field(it was signed) so option was redundant --- server/migrations/2020-02-04-083657_invites/up.sql | 2 +- server/src/models.rs | 2 +- server/src/schema.rs | 10 +--------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/server/migrations/2020-02-04-083657_invites/up.sql b/server/migrations/2020-02-04-083657_invites/up.sql index 6b3c4dd..f2651cd 100644 --- a/server/migrations/2020-02-04-083657_invites/up.sql +++ b/server/migrations/2020-02-04-083657_invites/up.sql @@ -2,6 +2,6 @@ CREATE TABLE IF NOT EXISTS `invites` ( `id` bigint UNSIGNED NOT NULL, `expires` bigint UNSIGNED NOT NULL, - `uses` integer, + `uses` integer NOT NULL, PRIMARY KEY( `id` ) ); diff --git a/server/src/models.rs b/server/src/models.rs index 321c67c..49eb2db 100644 --- a/server/src/models.rs +++ b/server/src/models.rs @@ -4,7 +4,7 @@ use crate::schema::{invites, users}; pub struct Invite { pub id: u64, pub expires: u64, - pub uses: Option, + pub uses: i32, } #[derive(Serialize, Deserialize, Queryable, Insertable, Debug)] diff --git a/server/src/schema.rs b/server/src/schema.rs index 1e865f7..ad6813b 100644 --- a/server/src/schema.rs +++ b/server/src/schema.rs @@ -2,14 +2,7 @@ table! { invites (id) { id -> Unsigned, expires -> Unsigned, - uses -> Nullable, - } -} - -table! { - new_users (token) { - token -> Varchar, - invite_id -> Unsigned, + uses -> Integer, } } @@ -24,6 +17,5 @@ table! { allow_tables_to_appear_in_same_query!( invites, - new_users, users, );