Update database structure
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
09f2ae9213
commit
32d3793025
@ -0,0 +1,2 @@
|
|||||||
|
DROP TABLE IF EXISTS accomodations_reservations;
|
||||||
|
DROP TABLE IF EXISTS accomodations_list;
|
@ -0,0 +1,24 @@
|
|||||||
|
-- Create tables
|
||||||
|
CREATE TABLE IF NOT EXISTS accommodations_list
|
||||||
|
(
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
family_id integer NOT NULL REFERENCES families,
|
||||||
|
time_create BIGINT NOT NULL,
|
||||||
|
time_update BIGINT NOT NULL,
|
||||||
|
need_validation BOOLEAN,
|
||||||
|
description text NULL,
|
||||||
|
open_to_reservation BOOLEAN
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS accommodations_reservations
|
||||||
|
(
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
family_id integer NOT NULL REFERENCES families ON DELETE CASCADE,
|
||||||
|
accommodation_id integer NOT NULL REFERENCES accommodations_list ON DELETE CASCADE,
|
||||||
|
user_id INTEGER NOT NULL REFERENCES users ON DELETE CASCADE,
|
||||||
|
time_create BIGINT NOT NULL,
|
||||||
|
time_update BIGINT NOT NULL,
|
||||||
|
reservation_start BIGINT NOT NULL,
|
||||||
|
reservation_end BIGINT NOT NULL,
|
||||||
|
validated BOOLEAN
|
||||||
|
);
|
@ -1,5 +1,31 @@
|
|||||||
// @generated automatically by Diesel CLI.
|
// @generated automatically by Diesel CLI.
|
||||||
|
|
||||||
|
diesel::table! {
|
||||||
|
accommodations_list (id) {
|
||||||
|
id -> Int4,
|
||||||
|
family_id -> Int4,
|
||||||
|
time_create -> Int8,
|
||||||
|
time_update -> Int8,
|
||||||
|
need_validation -> Nullable<Bool>,
|
||||||
|
description -> Nullable<Text>,
|
||||||
|
open_to_reservation -> Nullable<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! {
|
diesel::table! {
|
||||||
couples (id) {
|
couples (id) {
|
||||||
id -> Int4,
|
id -> Int4,
|
||||||
@ -119,6 +145,10 @@ diesel::table! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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!(couples -> families (family_id));
|
diesel::joinable!(couples -> families (family_id));
|
||||||
diesel::joinable!(couples -> photos (photo_id));
|
diesel::joinable!(couples -> photos (photo_id));
|
||||||
diesel::joinable!(members -> families (family_id));
|
diesel::joinable!(members -> families (family_id));
|
||||||
@ -127,6 +157,8 @@ diesel::joinable!(memberships -> families (family_id));
|
|||||||
diesel::joinable!(memberships -> users (user_id));
|
diesel::joinable!(memberships -> users (user_id));
|
||||||
|
|
||||||
diesel::allow_tables_to_appear_in_same_query!(
|
diesel::allow_tables_to_appear_in_same_query!(
|
||||||
|
accommodations_list,
|
||||||
|
accommodations_reservations,
|
||||||
couples,
|
couples,
|
||||||
families,
|
families,
|
||||||
members,
|
members,
|
||||||
|
Loading…
Reference in New Issue
Block a user