// @generated automatically by Diesel CLI.

diesel::table! {
    accommodations_list (id) {
        id -> Int4,
        family_id -> Int4,
        time_create -> Int8,
        time_update -> Int8,
        #[max_length = 50]
        name -> Varchar,
        need_validation -> Bool,
        description -> Nullable<Text>,
        #[max_length = 6]
        color -> Nullable<Varchar>,
        open_to_reservations -> Bool,
    }
}

diesel::table! {
    accommodations_reservations (id) {
        id -> Int4,
        family_id -> Int4,
        accommodation_id -> Int4,
        user_id -> Int4,
        time_create -> Int8,
        time_update -> Int8,
        reservation_start -> Int8,
        reservation_end -> Int8,
        validated -> Nullable<Bool>,
    }
}

diesel::table! {
    accommodations_reservations_cals_urls (id) {
        id -> Int4,
        family_id -> Int4,
        accommodation_id -> Nullable<Int4>,
        user_id -> Int4,
        #[max_length = 50]
        name -> Varchar,
        #[max_length = 50]
        token -> Varchar,
        time_create -> Int8,
        time_used -> Int8,
    }
}

diesel::table! {
    couples (id) {
        id -> Int4,
        family_id -> Int4,
        wife -> Nullable<Int4>,
        husband -> Nullable<Int4>,
        #[max_length = 1]
        state -> Nullable<Varchar>,
        photo_id -> Nullable<Int4>,
        time_create -> Int8,
        time_update -> Int8,
        wedding_year -> Nullable<Int2>,
        wedding_month -> Nullable<Int2>,
        wedding_day -> Nullable<Int2>,
        divorce_year -> Nullable<Int2>,
        divorce_month -> Nullable<Int2>,
        divorce_day -> Nullable<Int2>,
    }
}

diesel::table! {
    families (id) {
        id -> Int4,
        time_create -> Int8,
        #[max_length = 30]
        name -> Varchar,
        #[max_length = 7]
        invitation_code -> Varchar,
        disable_couple_photos -> Bool,
        enable_genealogy -> Bool,
        enable_accommodations -> Bool,
    }
}

diesel::table! {
    members (id) {
        id -> Int4,
        family_id -> Int4,
        #[max_length = 30]
        first_name -> Nullable<Varchar>,
        #[max_length = 30]
        last_name -> Nullable<Varchar>,
        #[max_length = 30]
        birth_last_name -> Nullable<Varchar>,
        photo_id -> Nullable<Int4>,
        #[max_length = 255]
        email -> Nullable<Varchar>,
        #[max_length = 30]
        phone -> Nullable<Varchar>,
        #[max_length = 155]
        address -> Nullable<Varchar>,
        #[max_length = 150]
        city -> Nullable<Varchar>,
        #[max_length = 12]
        postal_code -> Nullable<Varchar>,
        #[max_length = 2]
        country -> Nullable<Varchar>,
        #[max_length = 1]
        sex -> Nullable<Varchar>,
        time_create -> Int8,
        time_update -> Int8,
        mother -> Nullable<Int4>,
        father -> Nullable<Int4>,
        birth_year -> Nullable<Int2>,
        birth_month -> Nullable<Int2>,
        birth_day -> Nullable<Int2>,
        dead -> Bool,
        death_year -> Nullable<Int2>,
        death_month -> Nullable<Int2>,
        death_day -> Nullable<Int2>,
        note -> Nullable<Text>,
    }
}

diesel::table! {
    memberships (user_id, family_id) {
        user_id -> Int4,
        family_id -> Int4,
        time_create -> Int8,
        is_admin -> Bool,
    }
}

diesel::table! {
    photos (id) {
        id -> Int4,
        #[max_length = 36]
        file_id -> Varchar,
        time_create -> Int8,
        #[max_length = 150]
        mime_type -> Varchar,
        #[max_length = 130]
        sha512 -> Varchar,
        file_size -> Int4,
        #[max_length = 130]
        thumb_sha512 -> Varchar,
    }
}

diesel::table! {
    users (id) {
        id -> Int4,
        #[max_length = 30]
        name -> Varchar,
        #[max_length = 255]
        email -> Varchar,
        password -> Nullable<Varchar>,
        time_create -> Int8,
        #[max_length = 150]
        reset_password_token -> Nullable<Varchar>,
        time_gen_reset_token -> Int8,
        #[max_length = 150]
        delete_account_token -> Nullable<Varchar>,
        time_gen_delete_account_token -> Int8,
        time_activate -> Int8,
        active -> Bool,
        admin -> Bool,
    }
}

diesel::joinable!(accommodations_list -> families (family_id));
diesel::joinable!(accommodations_reservations -> accommodations_list (accommodation_id));
diesel::joinable!(accommodations_reservations -> families (family_id));
diesel::joinable!(accommodations_reservations -> users (user_id));
diesel::joinable!(accommodations_reservations_cals_urls -> accommodations_list (accommodation_id));
diesel::joinable!(accommodations_reservations_cals_urls -> families (family_id));
diesel::joinable!(accommodations_reservations_cals_urls -> users (user_id));
diesel::joinable!(couples -> families (family_id));
diesel::joinable!(couples -> photos (photo_id));
diesel::joinable!(members -> families (family_id));
diesel::joinable!(members -> photos (photo_id));
diesel::joinable!(memberships -> families (family_id));
diesel::joinable!(memberships -> users (user_id));

diesel::allow_tables_to_appear_in_same_query!(
    accommodations_list,
    accommodations_reservations,
    accommodations_reservations_cals_urls,
    couples,
    families,
    members,
    memberships,
    photos,
    users,
);
