Skip to content

Commit

Permalink
Updated DatabaseSetup
Browse files Browse the repository at this point in the history
Added UNIQUE constraint to category and cascade to delete and update for Charity_Categories.
  • Loading branch information
roaraf committed Apr 18, 2026
1 parent e372f91 commit d3ac180
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ FOREIGN KEY (`user_id`)
CREATE TABLE IF NOT EXISTS `apbaluna`.`Categories` (
`category_id` INT NOT NULL AUTO_INCREMENT,
`category` VARCHAR(255) NOT NULL,
PRIMARY KEY (`category_id`))
PRIMARY KEY (`category_id`),
UNIQUE (`category`)
)
ENGINE = InnoDB;
""";

Expand All @@ -221,8 +223,8 @@ FOREIGN KEY (`Categories_category_id`)
CONSTRAINT `fk_Categories_has_Charities_Charities1`
FOREIGN KEY (`Charities_UUID_charities`)
REFERENCES `apbaluna`.`Charities` (`UUID_charities`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
""";

Expand Down

0 comments on commit d3ac180

Please sign in to comment.