formatting and new tables
This commit is contained in:
parent
12062d2401
commit
b8e52791bb
6 changed files with 39 additions and 8 deletions
|
@ -1,2 +1,2 @@
|
|||
-- 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,
|
||||
time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
FOREIGN KEY (shift) REFERENCES shifts (id) ON DELETE CASCADE
|
||||
)
|
||||
);
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
2
migrations/2023-11-04-093417_create_shows/down.sql
Normal file
2
migrations/2023-11-04-093417_create_shows/down.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- This file should undo anything in `up.sql`
|
||||
DROP TABLE shows;
|
9
migrations/2023-11-04-093417_create_shows/up.sql
Normal file
9
migrations/2023-11-04-093417_create_shows/up.sql
Normal 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
|
||||
)
|
|
@ -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,
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue