Skip to content

Commit

Permalink
[fix] foreign key導入
Browse files Browse the repository at this point in the history
  • Loading branch information
hikahana committed Dec 9, 2024
1 parent 9af793f commit d83204b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions mysql/db/buy_reports.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ CREATE TABLE buy_reports (
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
FOREIGN KEY festival_item_id_foreign_key (festival_item_id) REFERENCES festival_items (id)
);
1 change: 1 addition & 0 deletions mysql/db/divisions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ CREATE TABLE divisions (
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
FOREIGN KEY financial_record_id_foreign_key (financial_record_id) REFERENCES divisions (id)
);
1 change: 1 addition & 0 deletions mysql/db/festival_items.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ CREATE TABLE festival_items (
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
FOREIGN KEY division_id_foreign_key (division_id) REFERENCES festival_items (id)
);
1 change: 1 addition & 0 deletions mysql/db/financial_records.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ CREATE TABLE financial_records (
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
FOREIGN KEY year_id_foreign_key (year_id) REFERENCES financial_records (id)
);
1 change: 1 addition & 0 deletions mysql/db/payment_receipts.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ CREATE TABLE payment_receipts (
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
FOREIGN KEY buy_report_id_foreign_key (buy_report_id) REFERENCES payment_receipts (id)
);
2 changes: 2 additions & 0 deletions mysql/db/user_groups.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ CREATE TABLE user_groups (
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id),
FOREIGN KEY user_id_foreign_key (user_id) REFERENCES user_groups (id)
FOREIGN KEY group_id_foreign_key (group_id) REFERENCES user_groups (id)
);

0 comments on commit d83204b

Please sign in to comment.