feat: add diesel setup to project
This commit is contained in:
parent
faeebf8376
commit
18a321853a
14 changed files with 203 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
mod comment;
|
||||
mod event;
|
||||
mod plant;
|
||||
mod schema;
|
||||
mod session;
|
||||
mod user;
|
||||
|
||||
|
|
|
|||
56
src/db/schema.rs
Normal file
56
src/db/schema.rs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
// @generated automatically by Diesel CLI.
|
||||
|
||||
diesel::table! {
|
||||
comments (id) {
|
||||
id -> Integer,
|
||||
plant_id -> Nullable<Integer>,
|
||||
comment -> Text,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
events (id) {
|
||||
id -> Integer,
|
||||
plant_id -> Integer,
|
||||
event_type -> Text,
|
||||
date -> Text,
|
||||
description -> Text,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
plants (id) {
|
||||
id -> Integer,
|
||||
name -> Text,
|
||||
species -> Text,
|
||||
description -> Text,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
sessions (id) {
|
||||
id -> Integer,
|
||||
user_id -> Integer,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
users (id) {
|
||||
id -> Integer,
|
||||
username -> Text,
|
||||
password_hash -> Text,
|
||||
admin -> Bool,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::joinable!(comments -> plants (plant_id));
|
||||
diesel::joinable!(events -> plants (plant_id));
|
||||
diesel::joinable!(sessions -> users (user_id));
|
||||
|
||||
diesel::allow_tables_to_appear_in_same_query!(
|
||||
comments,
|
||||
events,
|
||||
plants,
|
||||
sessions,
|
||||
users,
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue