bvplan/bvplan/src/db/schema.rs
2023-02-27 11:09:16 +01:00

230 lines
5 KiB
Rust

pub mod sql_types {
#[derive(diesel::sql_types::SqlType)]
#[diesel(postgres_type(name = "weekday"))]
pub struct Weekday;
#[derive(diesel::sql_types::SqlType)]
#[diesel(postgres_type(name = "substitution_type"))]
pub struct SubstitutionType;
#[derive(diesel::sql_types::SqlType)]
#[diesel(postgres_type(name = "week_type"))]
pub struct WeekType;
}
diesel::table! {
schoolyears {
id -> Integer,
untis_id -> Integer,
name -> VarChar,
active -> Bool,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
tenants {
id -> Integer,
untis_id -> Integer,
schoolyear_id -> Integer,
name -> VarChar,
active -> Bool,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
teachers {
id -> Integer,
untis_id -> Integer,
schoolyear_id -> Integer,
name -> VarChar,
forename -> Nullable<VarChar>,
display_name -> VarChar,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
classes {
id -> Integer,
untis_id -> Integer,
schoolyear_id -> Integer,
name -> VarChar,
long_name -> VarChar,
active -> Bool,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
subjects {
id -> Integer,
untis_id -> Integer,
schoolyear_id -> Integer,
name -> VarChar,
long_name -> VarChar,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
rooms {
id -> Integer,
untis_id -> Integer,
schoolyear_id -> Integer,
name -> VarChar,
long_name -> VarChar,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
departments {
id -> Integer,
untis_id -> Integer,
schoolyear_id -> Integer,
name -> VarChar,
long_name -> VarChar,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
holidays {
id -> Integer,
untis_id -> Integer,
schoolyear_id -> Integer,
name -> VarChar,
long_name -> VarChar,
start_date -> Date,
end_date -> Date,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
timegrids {
id -> Integer,
schoolyear_id -> Integer,
active -> Bool,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
use diesel::sql_types::*;
use super::sql_types::*;
timegrid_days {
id -> Integer,
timegrid_id -> Integer,
weekday -> Weekday,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
timegrid_time_unit {
id -> Integer,
timegrid_day_id -> Integer,
start_time -> Time,
end_time -> Time,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
use diesel::sql_types::*;
use super::sql_types::*;
substitution_queries {
id -> Integer,
schoolyear_id -> Integer,
date -> Date,
week_type -> WeekType,
queried_at -> Timestamp,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
use diesel::sql_types::*;
use super::sql_types::*;
substitutions {
id -> Integer,
substitution_query_id -> Integer,
subst_type -> SubstitutionType,
lesson_id -> Integer,
start_time -> Time,
end_time -> Time,
text -> Nullable<VarChar>,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
substitution_classes {
id -> Integer,
substitution_id -> Integer,
position -> SmallInt,
class_id -> Integer,
original_id -> Nullable<Integer>,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
substitution_teachers {
id -> Integer,
substitution_id -> Integer,
position -> SmallInt,
teacher_id -> Nullable<Integer>,
original_id -> Nullable<Integer>,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
substitution_subjects {
id -> Integer,
substitution_id -> Integer,
position -> SmallInt,
subject_id -> Integer,
original_id -> Nullable<Integer>,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}
diesel::table! {
substitution_rooms {
id -> Integer,
substitution_id -> Integer,
position -> SmallInt,
room_id -> Nullable<Integer>,
original_id -> Nullable<Integer>,
created_at -> Timestamp,
updated_at -> Nullable<Timestamp>,
}
}