Create initial database structure

This commit is contained in:
2025-03-17 19:06:18 +01:00
parent 0614b23d59
commit 64b672dc63
11 changed files with 709 additions and 0 deletions

View File

@ -1,3 +1,5 @@
fn main() {
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
println!("Hello, world!");
}

View File

@ -0,0 +1,105 @@
// @generated automatically by Diesel CLI.
diesel::table! {
account (id) {
id -> Int4,
#[max_length = 50]
name -> Varchar,
user_id -> Int4,
time_create -> Int8,
time_update -> Int8,
default_account -> Bool,
}
}
diesel::table! {
attachment (id) {
id -> Int4,
time_create -> Int8,
#[max_length = 150]
mime_type -> Varchar,
#[max_length = 130]
sha512 -> Varchar,
file_size -> Int4,
user_id -> Int4,
}
}
diesel::table! {
inbox (id) {
id -> Int4,
attachment_id -> Int4,
user_id -> Int4,
account_id -> Nullable<Int4>,
time_create -> Int8,
time_update -> Int8,
}
}
diesel::table! {
movement (id) {
id -> Int4,
account_id -> Int4,
time -> Int8,
#[max_length = 200]
label -> Varchar,
attachment_id -> Nullable<Int4>,
amount -> Float4,
checked -> Bool,
time_create -> Int8,
time_update -> Int8,
}
}
diesel::table! {
token (id) {
id -> Int4,
#[max_length = 150]
label -> Varchar,
time_create -> Int8,
time_update -> Int8,
user_id -> Int4,
#[max_length = 150]
token -> Varchar,
time_used -> Int8,
max_inactivity -> Nullable<Int4>,
#[max_length = 50]
ip_restriction -> Nullable<Varchar>,
read_only -> Bool,
right_account -> Bool,
right_movement -> Bool,
right_inbox -> Bool,
right_attachment -> Bool,
right_user -> Bool,
}
}
diesel::table! {
users (id) {
id -> Int4,
#[max_length = 255]
mail -> Varchar,
#[max_length = 150]
name -> Varchar,
time_create -> Int8,
time_update -> Int8,
}
}
diesel::joinable!(account -> users (user_id));
diesel::joinable!(attachment -> users (user_id));
diesel::joinable!(inbox -> account (account_id));
diesel::joinable!(inbox -> attachment (attachment_id));
diesel::joinable!(inbox -> users (user_id));
diesel::joinable!(movement -> account (account_id));
diesel::joinable!(movement -> attachment (attachment_id));
diesel::joinable!(token -> users (user_id));
diesel::allow_tables_to_appear_in_same_query!(
account,
attachment,
inbox,
movement,
token,
users,
);