setting diesel up more

This commit is contained in:
Chris Cochrun 2023-04-04 15:15:29 -05:00
parent 37a2dbd986
commit caed6e6367
5 changed files with 10 additions and 11 deletions

View file

@ -3,6 +3,7 @@
[print_schema] [print_schema]
file = "src/rust/schema.rs" file = "src/rust/schema.rs"
generate_missing_sql_type_definitions = false
[migrations_directory] [migrations_directory]
dir = "src/rust/migrations" dir = "src/rust/migrations"

View file

@ -83,6 +83,7 @@ mod image_model {
println!("SHOWING IMAGES"); println!("SHOWING IMAGES");
for image in results { for image in results {
println!("{}", image.title); println!("{}", image.title);
println!("{}", image.id);
println!("--------------\n"); println!("--------------\n");
println!("{}", image.path); println!("{}", image.path);
} }

View file

@ -15,12 +15,12 @@
// mod my_object; // mod my_object;
mod file_helper; mod file_helper;
pub mod image_model;
pub mod models;
pub mod schema;
mod service_thing; mod service_thing;
mod settings; mod settings;
mod slide_obj;
mod slide_model; mod slide_model;
mod image_model; mod slide_obj;
mod models;
mod schema;
// mod entities; // mod entities;
// mod video_thumbnail; // mod video_thumbnail;

View file

@ -4,5 +4,6 @@ use diesel::prelude::*;
pub struct Image { pub struct Image {
pub id: i32, pub id: i32,
pub title: String, pub title: String,
#[diesel(column_name = "filePath")]
pub path: String, pub path: String,
} }

View file

@ -4,7 +4,8 @@ diesel::table! {
images (id) { images (id) {
id -> Integer, id -> Integer,
title -> Text, title -> Text,
filePath -> Text, #[sql_name = "filePath"]
path -> Text,
} }
} }
@ -47,9 +48,4 @@ diesel::table! {
} }
} }
diesel::allow_tables_to_appear_in_same_query!( diesel::allow_tables_to_appear_in_same_query!(images, presentations, songs, videos,);
images,
presentations,
songs,
videos,
);