Start rust rewrite

This commit is contained in:
Tobias Reisinger 2021-11-04 23:37:16 +01:00
commit 12d57d020f
22 changed files with 2599 additions and 0 deletions
src/db

93
src/db/schema.rs Normal file
View file

@ -0,0 +1,93 @@
table! {
controllers (id) {
id -> Integer,
uid -> Text,
name -> Nullable<Text>,
ip -> Nullable<Text>,
port -> Nullable<Integer>,
relay_count -> Nullable<Integer>,
active -> Bool,
}
}
table! {
junction_relay_schedule (id) {
id -> Integer,
weekday -> SmallInt,
relay_id -> Nullable<Integer>,
schedule_id -> Nullable<Integer>,
}
}
table! {
junction_tag (id) {
id -> Integer,
tag_id -> Integer,
relay_id -> Nullable<Integer>,
schedule_id -> Nullable<Integer>,
}
}
table! {
macro_actions (id) {
id -> Integer,
macro_id -> Integer,
relay_id -> Nullable<Integer>,
schedule_id -> Nullable<Integer>,
weekday -> SmallInt,
}
}
table! {
macros (id) {
id -> Integer,
uid -> Text,
name -> Nullable<Text>,
}
}
table! {
relays (id) {
id -> Integer,
name -> Nullable<Text>,
number -> Integer,
controller_id -> Integer,
}
}
table! {
schedules (id) {
id -> Integer,
uid -> Binary,
name -> Text,
periods -> Text,
}
}
table! {
tags (id) {
id -> Integer,
tag -> Text,
}
}
joinable!(junction_relay_schedule -> relays (relay_id));
joinable!(junction_relay_schedule -> schedules (schedule_id));
joinable!(junction_tag -> relays (relay_id));
joinable!(junction_tag -> schedules (schedule_id));
joinable!(junction_tag -> tags (tag_id));
joinable!(macro_actions -> macros (macro_id));
joinable!(macro_actions -> relays (relay_id));
joinable!(macro_actions -> schedules (schedule_id));
joinable!(relays -> controllers (controller_id));
allow_tables_to_appear_in_same_query!(
controllers,
junction_relay_schedule,
junction_tag,
macro_actions,
macros,
relays,
schedules,
tags,
);