Commit cbc4e08d authored by Chunchi Che's avatar Chunchi Che

add cards db schema and models

parent 2e57c936
Pipeline #18096 failed with stages
in 3 minutes and 27 seconds
......@@ -14,3 +14,4 @@ pretty_env_logger = "0.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1"
diesel = { version = "2.0.0", features = ["sqlite"] }
diesel_derives = { version = "2.0.0", features = ["sqlite"] }
mod model;
mod schema;
use diesel_derives::Queryable;
#[derive(Queryable, Clone, Debug)]
#[diesel(table_name = datas)]
pub struct CradDatas {
pub id: i64,
pub ot: i32,
pub alias: i32,
pub setcode: i32,
pub type_: i32,
pub atk: i32,
pub def: i32,
pub level: i32,
pub race: i32,
pub attribute: i32,
pub category: i32,
}
// TODO: 这里字段应该命名得更清晰一点
#[derive(Queryable, Clone, Debug)]
#[diesel(table_name = texts)]
pub struct CradTexts {
pub id: i64,
pub name: String,
pub str1: Option<String>,
pub str2: Option<String>,
pub str3: Option<String>,
pub str4: Option<String>,
pub str5: Option<String>,
pub str6: Option<String>,
pub str7: Option<String>,
pub str8: Option<String>,
pub str9: Option<String>,
pub str10: Option<String>,
pub str11: Option<String>,
pub str12: Option<String>,
pub str13: Option<String>,
pub str14: Option<String>,
pub str15: Option<String>,
pub str16: Option<String>,
}
diesel::table! {
datas (id) {
id -> BigInt,
ot -> Integer,
alias -> Integer,
setcode -> Integer,
type_ -> Integer,
atk -> Integer,
def -> Integer,
level -> Integer,
race -> Integer,
attribute -> Integer,
category -> Integer,
}
}
diesel::table! {
texts (id) {
id -> BigInt,
name -> Text,
desc -> Nullable<Text>,
str1 -> Nullable<Text>,
str2 -> Nullable<Text>,
str3 -> Nullable<Text>,
str4 -> Nullable<Text>,
str5 -> Nullable<Text>,
str6 -> Nullable<Text>,
str7 -> Nullable<Text>,
str8 -> Nullable<Text>,
str9 -> Nullable<Text>,
str10 -> Nullable<Text>,
str11 -> Nullable<Text>,
str12 -> Nullable<Text>,
str13 -> Nullable<Text>,
str14 -> Nullable<Text>,
str15 -> Nullable<Text>,
str16 -> Nullable<Text>,
}
}
mod db;
pub fn service(param: String) -> String {
todo!()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment