formatting and new tables
parent
12062d2401
commit
b8e52791bb
|
@ -1,2 +1,2 @@
|
||||||
-- This file should undo anything in `up.sql`
|
-- This file should undo anything in `up.sql`
|
||||||
DROP TABLE shifts
|
DROP TABLE shifts;
|
||||||
|
|
|
@ -7,4 +7,4 @@ CREATE TABLE
|
||||||
shift INT UNSIGNED NOT NULL,
|
shift INT UNSIGNED NOT NULL,
|
||||||
time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||||
FOREIGN KEY (shift) REFERENCES shifts (id) ON DELETE CASCADE
|
FOREIGN KEY (shift) REFERENCES shifts (id) ON DELETE CASCADE
|
||||||
)
|
);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
-- Your SQL goes here
|
-- Your SQL goes here
|
||||||
CREATE TABLE dancers
|
CREATE TABLE
|
||||||
(
|
dancers (
|
||||||
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
|
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
|
||||||
stage_name TEXT
|
stage_name TEXT NOT NULL,
|
||||||
name TEXT,
|
name TEXT NOT NULL
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
-- This file should undo anything in `up.sql`
|
||||||
|
DROP TABLE shows;
|
|
@ -0,0 +1,9 @@
|
||||||
|
-- Your SQL goes here
|
||||||
|
CREATE TABLE
|
||||||
|
shows (
|
||||||
|
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
dancer INT UNSIGNED NOT NULL,
|
||||||
|
start DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||||
|
end DATETIME DEFAULT NULL,
|
||||||
|
FOREIGN KEY (dancer) REFERENCES dancers (id) ON DELETE RESTRICT
|
||||||
|
)
|
|
@ -1,5 +1,13 @@
|
||||||
// @generated automatically by Diesel CLI.
|
// @generated automatically by Diesel CLI.
|
||||||
|
|
||||||
|
diesel::table! {
|
||||||
|
dancers (id) {
|
||||||
|
id -> Unsigned<Integer>,
|
||||||
|
stage_name -> Text,
|
||||||
|
name -> Text,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
drinks (id) {
|
drinks (id) {
|
||||||
id -> Unsigned<Integer>,
|
id -> Unsigned<Integer>,
|
||||||
|
@ -18,9 +26,21 @@ diesel::table! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
diesel::table! {
|
||||||
|
shows (id) {
|
||||||
|
id -> Unsigned<Integer>,
|
||||||
|
dancer -> Unsigned<Integer>,
|
||||||
|
start -> Datetime,
|
||||||
|
end -> Nullable<Datetime>,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
diesel::joinable!(drinks -> shifts (shift));
|
diesel::joinable!(drinks -> shifts (shift));
|
||||||
|
diesel::joinable!(shows -> dancers (dancer));
|
||||||
|
|
||||||
diesel::allow_tables_to_appear_in_same_query!(
|
diesel::allow_tables_to_appear_in_same_query!(
|
||||||
|
dancers,
|
||||||
drinks,
|
drinks,
|
||||||
shifts,
|
shifts,
|
||||||
|
shows,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue