// @generated automatically by Diesel CLI.

diesel::table! {
    accounts (id) {
        id -> Int4,
        #[max_length = 50]
        name -> Varchar,
        user_id -> Int4,
        time_create -> Int8,
        time_update -> Int8,
        #[sql_name = "type"]
        #[max_length = 1]
        type_ -> Varchar,
        default_account -> Bool,
    }
}

diesel::table! {
    files (id) {
        id -> Int4,
        time_create -> Int8,
        #[max_length = 150]
        mime_type -> Varchar,
        #[max_length = 130]
        sha512 -> Varchar,
        file_size -> Int4,
        #[max_length = 150]
        file_name -> Varchar,
        user_id -> Int4,
    }
}

diesel::table! {
    inbox (id) {
        id -> Int4,
        file_id -> Int4,
        user_id -> Int4,
        movement_id -> Nullable<Int4>,
        time -> Int8,
        #[max_length = 200]
        label -> Nullable<Varchar>,
        amount -> Nullable<Float4>,
        time_create -> Int8,
        time_update -> Int8,
    }
}

diesel::table! {
    movements (id) {
        id -> Int4,
        account_id -> Int4,
        time -> Int8,
        #[max_length = 200]
        label -> Varchar,
        file_id -> Nullable<Int4>,
        amount -> Float4,
        checked -> Bool,
        time_create -> Int8,
        time_update -> Int8,
    }
}

diesel::table! {
    tokens (id) {
        id -> Int4,
        #[max_length = 150]
        name -> Varchar,
        time_create -> Int8,
        user_id -> Int4,
        #[max_length = 150]
        token_value -> Varchar,
        time_used -> Int8,
        max_inactivity -> Int4,
        #[max_length = 50]
        ip_net -> Nullable<Varchar>,
        read_only -> Bool,
        right_account -> Bool,
        right_movement -> Bool,
        right_inbox -> Bool,
        right_file -> Bool,
        right_auth -> Bool,
        right_stats -> Bool,
        right_backup -> 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!(accounts -> users (user_id));
diesel::joinable!(files -> users (user_id));
diesel::joinable!(inbox -> files (file_id));
diesel::joinable!(inbox -> movements (movement_id));
diesel::joinable!(inbox -> users (user_id));
diesel::joinable!(movements -> accounts (account_id));
diesel::joinable!(movements -> files (file_id));
diesel::joinable!(tokens -> users (user_id));

diesel::allow_tables_to_appear_in_same_query!(accounts, files, inbox, movements, tokens, users,);
