Update for db
This commit is contained in:
46
src/db/models.rs
Normal file
46
src/db/models.rs
Normal file
@@ -0,0 +1,46 @@
|
||||
// Generated by diesel_ext
|
||||
|
||||
#![allow(unused)]
|
||||
#![allow(clippy::all)]
|
||||
|
||||
|
||||
use uuid::Uuid;
|
||||
#[derive(Queryable, Debug)]
|
||||
pub struct Icon {
|
||||
pub id: Uuid,
|
||||
pub name: String,
|
||||
pub content_type: Option<String>,
|
||||
pub url: Option<String>,
|
||||
pub width: Option<i32>,
|
||||
pub height: Option<i32>,
|
||||
pub state: Option<Json>,
|
||||
}
|
||||
|
||||
#[derive(Queryable, Debug)]
|
||||
pub struct Ingredient {
|
||||
pub id: Uuid,
|
||||
pub resource: Uuid,
|
||||
pub quantity: i32,
|
||||
pub state: Option<Json>,
|
||||
pub recipe: Uuid,
|
||||
}
|
||||
|
||||
#[derive(Queryable, Debug)]
|
||||
pub struct Recipe {
|
||||
pub id: Uuid,
|
||||
pub resource: Uuid,
|
||||
pub recipe_type: String,
|
||||
pub duration: i32,
|
||||
pub state: Option<Json>,
|
||||
}
|
||||
|
||||
#[derive(Queryable, Debug)]
|
||||
pub struct Resource {
|
||||
pub id: Uuid,
|
||||
pub name: String,
|
||||
pub title: String,
|
||||
pub url: Option<String>,
|
||||
pub icon: Option<Uuid>,
|
||||
pub state: Option<Json>,
|
||||
}
|
||||
|
||||
63
src/db/schema.rs
Normal file
63
src/db/schema.rs
Normal file
@@ -0,0 +1,63 @@
|
||||
// @generated automatically by Diesel CLI.
|
||||
|
||||
diesel::table! {
|
||||
icon (id) {
|
||||
id -> Uuid,
|
||||
#[max_length = 255]
|
||||
name -> Varchar,
|
||||
#[max_length = 255]
|
||||
content_type -> Nullable<Varchar>,
|
||||
#[max_length = 512]
|
||||
url -> Nullable<Varchar>,
|
||||
width -> Nullable<Int4>,
|
||||
height -> Nullable<Int4>,
|
||||
state -> Nullable<Json>,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
ingredient (id) {
|
||||
id -> Uuid,
|
||||
resource -> Uuid,
|
||||
quantity -> Int4,
|
||||
state -> Nullable<Json>,
|
||||
recipe -> Uuid,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
recipe (id) {
|
||||
id -> Uuid,
|
||||
resource -> Uuid,
|
||||
#[max_length = 50]
|
||||
recipe_type -> Varchar,
|
||||
duration -> Int4,
|
||||
state -> Nullable<Json>,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
resource (id) {
|
||||
id -> Uuid,
|
||||
#[max_length = 255]
|
||||
name -> Varchar,
|
||||
#[max_length = 255]
|
||||
title -> Varchar,
|
||||
#[max_length = 512]
|
||||
url -> Nullable<Varchar>,
|
||||
icon -> Nullable<Uuid>,
|
||||
state -> Nullable<Json>,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::joinable!(ingredient -> recipe (recipe));
|
||||
diesel::joinable!(ingredient -> resource (resource));
|
||||
diesel::joinable!(recipe -> resource (resource));
|
||||
diesel::joinable!(resource -> icon (icon));
|
||||
|
||||
diesel::allow_tables_to_appear_in_same_query!(
|
||||
icon,
|
||||
ingredient,
|
||||
recipe,
|
||||
resource,
|
||||
);
|
||||
Reference in New Issue
Block a user