fix: make literals field value not optional

This commit is contained in:
Akulij 2025-04-03 23:00:26 +09:00
parent c977500ee4
commit 3f2ee083cd
4 changed files with 13 additions and 3 deletions

View File

@ -0,0 +1,2 @@
ALTER TABLE literals
ALTER COLUMN value DROP NOT NULL;

View File

@ -0,0 +1,2 @@
ALTER TABLE literals
ALTER COLUMN value SET NOT NULL;

View File

@ -3,13 +3,14 @@
#![allow(unused)] #![allow(unused)]
#![allow(clippy::all)] #![allow(clippy::all)]
use diesel::prelude::*; use diesel::prelude::*;
#[derive(Queryable, Debug)] #[derive(Queryable, Debug)]
#[diesel(table_name = literals)] #[diesel(table_name = literals)]
pub struct Literal { pub struct Literal {
pub id: i32, pub id: i32,
pub token: String, pub token: String,
pub value: Option<String>, pub value: String,
} }
#[derive(Queryable, Debug)] #[derive(Queryable, Debug)]
@ -27,3 +28,4 @@ pub struct User {
pub id: i64, pub id: i64,
pub is_admin: bool, pub is_admin: bool,
} }

View File

@ -5,7 +5,7 @@ diesel::table! {
id -> Int4, id -> Int4,
#[max_length = 255] #[max_length = 255]
token -> Varchar, token -> Varchar,
value -> Nullable<Text>, value -> Text,
} }
} }
@ -26,4 +26,8 @@ diesel::table! {
} }
} }
diesel::allow_tables_to_appear_in_same_query!(literals, messages, users,); diesel::allow_tables_to_appear_in_same_query!(
literals,
messages,
users,
);