formatting and new tables

main
Zynh0722 2023-11-04 02:56:05 -07:00
parent 12062d2401
commit b8e52791bb
6 changed files with 39 additions and 8 deletions

View File

@ -1,2 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE shifts
DROP TABLE shifts;

View File

@ -7,4 +7,4 @@ CREATE TABLE
shift INT UNSIGNED NOT NULL,
time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
FOREIGN KEY (shift) REFERENCES shifts (id) ON DELETE CASCADE
)
);

View File

@ -1,7 +1,7 @@
-- Your SQL goes here
CREATE TABLE dancers
(
CREATE TABLE
dancers (
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
stage_name TEXT
name TEXT,
)
stage_name TEXT NOT NULL,
name TEXT NOT NULL
)

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE shows;

View File

@ -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
)

View File

@ -1,5 +1,13 @@
// @generated automatically by Diesel CLI.
diesel::table! {
dancers (id) {
id -> Unsigned<Integer>,
stage_name -> Text,
name -> Text,
}
}
diesel::table! {
drinks (id) {
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!(shows -> dancers (dancer));
diesel::allow_tables_to_appear_in_same_query!(
dancers,
drinks,
shifts,
shows,
);