From e9d54a83f5a110ff8a6c4fa0077fd291b53f026a Mon Sep 17 00:00:00 2001 From: sticks Date: Mon, 25 Nov 2024 20:21:11 -0600 Subject: [PATCH] sobbing --- ...08dcfe9cdb932a746b6c9c4fe3a6205b857f0932d2c7ed2a9b172.json | 4 ++-- ...00f9fcd07a40acfebed83dabca46bd3bf41478bc62243cfa03066.json | 4 ++-- .../20241126022017_make_quotes_timestamp_not_nullable.sql | 3 +++ src/handlers/db.rs | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 migrations/20241126022017_make_quotes_timestamp_not_nullable.sql diff --git a/.sqlx/query-b4e2733da7f08dcfe9cdb932a746b6c9c4fe3a6205b857f0932d2c7ed2a9b172.json b/.sqlx/query-b4e2733da7f08dcfe9cdb932a746b6c9c4fe3a6205b857f0932d2c7ed2a9b172.json index 4ab5358..d246188 100644 --- a/.sqlx/query-b4e2733da7f08dcfe9cdb932a746b6c9c4fe3a6205b857f0932d2c7ed2a9b172.json +++ b/.sqlx/query-b4e2733da7f08dcfe9cdb932a746b6c9c4fe3a6205b857f0932d2c7ed2a9b172.json @@ -53,7 +53,7 @@ "name": "added_at", "type_info": { "type": "Timestamp", - "flags": "UNSIGNED | BINARY | TIMESTAMP", + "flags": "NOT_NULL | UNSIGNED | BINARY | TIMESTAMP", "max_size": 19 } } @@ -67,7 +67,7 @@ false, false, false, - true + false ] }, "hash": "b4e2733da7f08dcfe9cdb932a746b6c9c4fe3a6205b857f0932d2c7ed2a9b172" diff --git a/.sqlx/query-d73179806cd00f9fcd07a40acfebed83dabca46bd3bf41478bc62243cfa03066.json b/.sqlx/query-d73179806cd00f9fcd07a40acfebed83dabca46bd3bf41478bc62243cfa03066.json index 354dcbf..741d137 100644 --- a/.sqlx/query-d73179806cd00f9fcd07a40acfebed83dabca46bd3bf41478bc62243cfa03066.json +++ b/.sqlx/query-d73179806cd00f9fcd07a40acfebed83dabca46bd3bf41478bc62243cfa03066.json @@ -53,7 +53,7 @@ "name": "added_at", "type_info": { "type": "Timestamp", - "flags": "UNSIGNED | BINARY | TIMESTAMP", + "flags": "NOT_NULL | UNSIGNED | BINARY | TIMESTAMP", "max_size": 19 } } @@ -67,7 +67,7 @@ false, false, false, - true + false ] }, "hash": "d73179806cd00f9fcd07a40acfebed83dabca46bd3bf41478bc62243cfa03066" diff --git a/migrations/20241126022017_make_quotes_timestamp_not_nullable.sql b/migrations/20241126022017_make_quotes_timestamp_not_nullable.sql new file mode 100644 index 0000000..a33170c --- /dev/null +++ b/migrations/20241126022017_make_quotes_timestamp_not_nullable.sql @@ -0,0 +1,3 @@ +-- Add migration script here +ALTER TABLE quotes +MODIFY added_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP; diff --git a/src/handlers/db.rs b/src/handlers/db.rs index 45b9985..22c21fb 100644 --- a/src/handlers/db.rs +++ b/src/handlers/db.rs @@ -122,7 +122,7 @@ impl DatabaseController { username: q.username, quote: q.quote, added_by: q.added_by, - added_at: q.added_at.unwrap(), + added_at: q.added_at, })), Err(sqlx::Error::RowNotFound) => Ok(None), Err(e) => Err(e), @@ -142,7 +142,7 @@ impl DatabaseController { username: q.username, quote: q.quote, added_by: q.added_by, - added_at: q.added_at.unwrap(), + added_at: q.added_at, }); }