Start rust rewrite
This commit is contained in:
commit
12d57d020f
22 changed files with 2599 additions and 0 deletions
src/db
93
src/db/schema.rs
Normal file
93
src/db/schema.rs
Normal 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,
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue