-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '56-2-startup/database-fix' of git.ntnu.no:cathrkri/syst…
…emutviklingTeam6 into 56-2-startup/database-fix
- Loading branch information
Showing
88 changed files
with
9,720 additions
and
1,033 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,203 @@ | ||
| -- MySQL Workbench Forward Engineering | ||
|
|
||
| SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; | ||
| SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; | ||
| SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; | ||
|
|
||
| -- ----------------------------------------------------- | ||
| -- Schema apbaluna | ||
| -- ----------------------------------------------------- | ||
|
|
||
| -- ----------------------------------------------------- | ||
| -- Schema apbaluna | ||
| -- ----------------------------------------------------- | ||
| CREATE SCHEMA IF NOT EXISTS `apbaluna` DEFAULT CHARACTER SET utf8 ; | ||
| USE `apbaluna` ; | ||
|
|
||
| -- ----------------------------------------------------- | ||
| -- Table `apbaluna`.`Charities` | ||
| -- ----------------------------------------------------- | ||
| CREATE TABLE IF NOT EXISTS `apbaluna`.`Charities` ( | ||
| `UUID_charities` CHAR(36) NOT NULL, | ||
| `org_number` VARCHAR(255) NOT NULL, | ||
| `charity_name` VARCHAR(255) NOT NULL, | ||
| `charity_description` VARCHAR(255) NOT NULL, | ||
| `charity_link` VARCHAR(255) NOT NULL, | ||
| `pre_approved` TINYINT NOT NULL, | ||
| `status` VARCHAR(255) NOT NULL, | ||
| PRIMARY KEY (`UUID_charities`)) | ||
| ENGINE = InnoDB; | ||
|
|
||
|
|
||
| -- ----------------------------------------------------- | ||
| -- Table `apbaluna`.`User` | ||
| -- ----------------------------------------------------- | ||
| CREATE TABLE IF NOT EXISTS `apbaluna`.`User` ( | ||
| `UUID_User` CHAR(36) NOT NULL, | ||
| `user_name` VARCHAR(255) NOT NULL, | ||
| `user_email` VARCHAR(255) NOT NULL, | ||
| `role` VARCHAR(45) NOT NULL, | ||
| PRIMARY KEY (`UUID_User`)) | ||
| ENGINE = InnoDB; | ||
|
|
||
|
|
||
| -- ----------------------------------------------------- | ||
| -- Table `apbaluna`.`Donations` | ||
| -- ----------------------------------------------------- | ||
| CREATE TABLE IF NOT EXISTS `apbaluna`.`Donations` ( | ||
| `UUID_Donations` CHAR(36) NOT NULL, | ||
| `amount` DECIMAL NOT NULL, | ||
| `date` DATE NOT NULL, | ||
| `charity_id` CHAR(36) NOT NULL, | ||
| `user_id` CHAR(36) NOT NULL, | ||
| PRIMARY KEY (`UUID_Donations`), | ||
| INDEX `fk_Donations_Charities_idx` (`charity_id` ASC) VISIBLE, | ||
| INDEX `fk_Donations_User1_idx` (`user_id` ASC) VISIBLE, | ||
| CONSTRAINT `fk_Donations_Charities` | ||
| FOREIGN KEY (`charity_id`) | ||
| REFERENCES `apbaluna`.`Charities` (`UUID_charities`) | ||
| ON DELETE NO ACTION | ||
| ON UPDATE NO ACTION, | ||
| CONSTRAINT `fk_Donations_User1` | ||
| FOREIGN KEY (`user_id`) | ||
| REFERENCES `apbaluna`.`User` (`UUID_User`) | ||
| ON DELETE NO ACTION | ||
| ON UPDATE NO ACTION) | ||
| ENGINE = InnoDB; | ||
|
|
||
|
|
||
| -- ----------------------------------------------------- | ||
| -- Table `apbaluna`.`Settings` | ||
| -- ----------------------------------------------------- | ||
| CREATE TABLE IF NOT EXISTS `apbaluna`.`Settings` ( | ||
| `User_UUID_User` CHAR(36) NOT NULL, | ||
| `isAnonymous` TINYINT NOT NULL, | ||
| `language` VARCHAR(45) NOT NULL, | ||
| `lightmode` TINYINT NOT NULL, | ||
| PRIMARY KEY (`User_UUID_User`), | ||
| INDEX `fk_Settings_User1_idx` (`User_UUID_User` ASC) VISIBLE, | ||
| CONSTRAINT `fk_Settings_User1` | ||
| FOREIGN KEY (`User_UUID_User`) | ||
| REFERENCES `apbaluna`.`User` (`UUID_User`) | ||
| ON DELETE NO ACTION | ||
| ON UPDATE NO ACTION) | ||
| ENGINE = InnoDB; | ||
|
|
||
|
|
||
| -- ----------------------------------------------------- | ||
| -- Table `apbaluna`.`Messages` | ||
| -- ----------------------------------------------------- | ||
| CREATE TABLE IF NOT EXISTS `apbaluna`.`Messages` ( | ||
| `UUID_message` CHAR(36) NOT NULL, | ||
| `message_title` VARCHAR(255) NOT NULL, | ||
| `message_content` VARCHAR(255) NOT NULL, | ||
| `message_date` DATE NOT NULL, | ||
| `sender_user_id` CHAR(36) NULL, | ||
| `sender_charity_id` CHAR(36) NULL, | ||
| `user_id` CHAR(36) NOT NULL, | ||
| PRIMARY KEY (`UUID_message`), | ||
| INDEX `fk_Messages_User1_idx` (`sender_user_id` ASC) VISIBLE, | ||
| INDEX `fk_Messages_Charities1_idx` (`sender_charity_id` ASC) VISIBLE, | ||
| INDEX `fk_Messages_User2_idx` (`user_id` ASC) VISIBLE, | ||
| CONSTRAINT `fk_Messages_User1` | ||
| FOREIGN KEY (`sender_user_id`) | ||
| REFERENCES `apbaluna`.`User` (`UUID_User`) | ||
| ON DELETE NO ACTION | ||
| ON UPDATE NO ACTION, | ||
| CONSTRAINT `fk_Messages_Charities1` | ||
| FOREIGN KEY (`sender_charity_id`) | ||
| REFERENCES `apbaluna`.`Charities` (`UUID_charities`) | ||
| ON DELETE NO ACTION | ||
| ON UPDATE NO ACTION, | ||
| CONSTRAINT `fk_Messages_User2` | ||
| FOREIGN KEY (`user_id`) | ||
| REFERENCES `apbaluna`.`User` (`UUID_User`) | ||
| ON DELETE NO ACTION | ||
| ON UPDATE NO ACTION) | ||
| ENGINE = InnoDB; | ||
|
|
||
|
|
||
| -- ----------------------------------------------------- | ||
| -- Table `apbaluna`.`Feedback` | ||
| -- ----------------------------------------------------- | ||
| CREATE TABLE IF NOT EXISTS `apbaluna`.`Feedback` ( | ||
| `UUID_feedback` CHAR(36) NOT NULL, | ||
| `feedback_comment` VARCHAR(255) NOT NULL, | ||
| `feedback_date` DATE NOT NULL, | ||
| `isAnonymous` TINYINT NOT NULL, | ||
| `charity_id` CHAR(36) NOT NULL, | ||
| `user_id` CHAR(36) NOT NULL, | ||
| PRIMARY KEY (`UUID_feedback`), | ||
| INDEX `fk_Feedback_Charities1_idx` (`charity_id` ASC) VISIBLE, | ||
| INDEX `fk_Feedback_User1_idx` (`user_id` ASC) VISIBLE, | ||
| CONSTRAINT `fk_Feedback_Charities1` | ||
| FOREIGN KEY (`charity_id`) | ||
| REFERENCES `apbaluna`.`Charities` (`UUID_charities`) | ||
| ON DELETE NO ACTION | ||
| ON UPDATE NO ACTION, | ||
| CONSTRAINT `fk_Feedback_User1` | ||
| FOREIGN KEY (`user_id`) | ||
| REFERENCES `apbaluna`.`User` (`UUID_User`) | ||
| ON DELETE NO ACTION | ||
| ON UPDATE NO ACTION) | ||
| ENGINE = InnoDB; | ||
|
|
||
|
|
||
| -- ----------------------------------------------------- | ||
| -- Table `apbaluna`.`Categories` | ||
| -- ----------------------------------------------------- | ||
| CREATE TABLE IF NOT EXISTS `apbaluna`.`Categories` ( | ||
| `category_id` INT NOT NULL AUTO_INCREMENT, | ||
| `category` VARCHAR(255) NOT NULL, | ||
| PRIMARY KEY (`category_id`)) | ||
| ENGINE = InnoDB; | ||
|
|
||
|
|
||
| -- ----------------------------------------------------- | ||
| -- Table `apbaluna`.`Charity_Categories` | ||
| -- ----------------------------------------------------- | ||
| CREATE TABLE IF NOT EXISTS `apbaluna`.`Charity_Categories` ( | ||
| `Categories_category_id` INT NOT NULL, | ||
| `Charities_UUID_charities` CHAR(36) NOT NULL, | ||
| PRIMARY KEY (`Categories_category_id`, `Charities_UUID_charities`), | ||
| INDEX `fk_Categories_has_Charities_Charities1_idx` (`Charities_UUID_charities` ASC) VISIBLE, | ||
| INDEX `fk_Categories_has_Charities_Categories1_idx` (`Categories_category_id` ASC) VISIBLE, | ||
| CONSTRAINT `fk_Categories_has_Charities_Categories1` | ||
| FOREIGN KEY (`Categories_category_id`) | ||
| REFERENCES `apbaluna`.`Categories` (`category_id`) | ||
| ON DELETE NO ACTION | ||
| ON UPDATE NO ACTION, | ||
| CONSTRAINT `fk_Categories_has_Charities_Charities1` | ||
| FOREIGN KEY (`Charities_UUID_charities`) | ||
| REFERENCES `apbaluna`.`Charities` (`UUID_charities`) | ||
| ON DELETE NO ACTION | ||
| ON UPDATE NO ACTION) | ||
| ENGINE = InnoDB; | ||
|
|
||
|
|
||
| -- ----------------------------------------------------- | ||
| -- Table `apbaluna`.`CharityUsers` | ||
| -- ----------------------------------------------------- | ||
| CREATE TABLE IF NOT EXISTS `apbaluna`.`CharityUsers` ( | ||
| `Charities_UUID_charities` CHAR(36) NOT NULL, | ||
| `User_UUID_User` CHAR(36) NOT NULL, | ||
| PRIMARY KEY (`Charities_UUID_charities`, `User_UUID_User`), | ||
| INDEX `fk_Charities_has_User_User1_idx` (`User_UUID_User` ASC) VISIBLE, | ||
| INDEX `fk_Charities_has_User_Charities1_idx` (`Charities_UUID_charities` ASC) VISIBLE, | ||
| CONSTRAINT `fk_Charities_has_User_Charities1` | ||
| FOREIGN KEY (`Charities_UUID_charities`) | ||
| REFERENCES `apbaluna`.`Charities` (`UUID_charities`) | ||
| ON DELETE NO ACTION | ||
| ON UPDATE NO ACTION, | ||
| CONSTRAINT `fk_Charities_has_User_User1` | ||
| FOREIGN KEY (`User_UUID_User`) | ||
| REFERENCES `apbaluna`.`User` (`UUID_User`) | ||
| ON DELETE NO ACTION | ||
| ON UPDATE NO ACTION) | ||
| ENGINE = InnoDB; | ||
|
|
||
| USE `apbaluna`; | ||
|
|
||
| SET SQL_MODE=@OLD_SQL_MODE; | ||
| SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; | ||
| SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; |
Oops, something went wrong.