text: -- MySQL Script generated by MySQL Workbench
  -- Sun Feb 13 18:13:41 2022
  -- Model: New Model    Version: 1.0
  -- 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 mydb
  -- -----------------------------------------------------
  -- -----------------------------------------------------
  -- Schema breakroutines
  -- -----------------------------------------------------
  
  -- -----------------------------------------------------
  -- Schema breakroutines
  -- -----------------------------------------------------
  CREATE SCHEMA IF NOT EXISTS `breakroutines` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci ;
  USE `breakroutines` ;
  
  -- -----------------------------------------------------
  -- Table `breakroutines`.`users`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `breakroutines`.`users` (
    `user_id` INT NOT NULL AUTO_INCREMENT,
    `first_name` VARCHAR(100) NOT NULL,
    `last_name` VARCHAR(100) NOT NULL,
    `email` VARCHAR(250) NOT NULL,
    `phone_number` VARCHAR(10) NULL DEFAULT NULL,
    `profile_pic` VARCHAR(250) NULL DEFAULT NULL,
    `is_active` BIT(1) NOT NULL DEFAULT b'1',
    `address` VARCHAR(200) NULL DEFAULT NULL,
    `city` VARCHAR(150) NULL DEFAULT NULL,
    `state` VARCHAR(200) NULL DEFAULT NULL,
    PRIMARY KEY (`user_id`),
    UNIQUE INDEX `users_idx_1` (`email` ASC) VISIBLE)
  ENGINE = InnoDB
  AUTO_INCREMENT = 4
  DEFAULT CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci;
  
  
  -- -----------------------------------------------------
  -- Table `breakroutines`.`trips`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `breakroutines`.`trips` (
    `trip_id` BIGINT NOT NULL AUTO_INCREMENT,
    `user_id` INT NOT NULL,
    `name` VARCHAR(250) NOT NULL,
    `duration` TIME NOT NULL,
    `price` DECIMAL(19,2) NOT NULL,
    `description` VARCHAR(10000) NOT NULL,
    `latitude` DECIMAL(9,6) NULL DEFAULT NULL,
    `longitude` DECIMAL(9,6) NULL DEFAULT NULL,
    PRIMARY KEY (`trip_id`),
    UNIQUE INDEX `trips_idx_1` (`name` ASC) VISIBLE,
    INDEX `trips_fk_1_idx` (`user_id` ASC) VISIBLE,
    CONSTRAINT `trips_fk_1`
      FOREIGN KEY (`user_id`)
      REFERENCES `breakroutines`.`users` (`user_id`))
  ENGINE = InnoDB
  AUTO_INCREMENT = 3
  DEFAULT CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci;
  
  
  -- -----------------------------------------------------
  -- Table `breakroutines`.`reviews`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `breakroutines`.`reviews` (
    `review_id` BIGINT NOT NULL AUTO_INCREMENT,
    `user_id` INT NOT NULL,
    `trip_id` BIGINT NOT NULL,
    `description` VARCHAR(600) NOT NULL,
    `score` TINYINT NOT NULL,
    PRIMARY KEY (`review_id`),
    INDEX `reviews_fk_1_idx` (`user_id` ASC) VISIBLE,
    INDEX `review_fk_2_idx` (`trip_id` ASC) VISIBLE,
    CONSTRAINT `review_fk_1`
      FOREIGN KEY (`user_id`)
      REFERENCES `breakroutines`.`users` (`user_id`),
    CONSTRAINT `review_fk_2`
      FOREIGN KEY (`trip_id`)
      REFERENCES `breakroutines`.`trips` (`trip_id`))
  ENGINE = InnoDB
  AUTO_INCREMENT = 5
  DEFAULT CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci;
  
  
  -- -----------------------------------------------------
  -- Table `breakroutines`.`trip_photos`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `breakroutines`.`trip_photos` (
    `trip_photo_id` BIGINT NOT NULL AUTO_INCREMENT,
    `user_id` INT NOT NULL,
    `trip_id` BIGINT NOT NULL,
    `photo` VARCHAR(250) NOT NULL,
    `is_default` BIT(1) NOT NULL DEFAULT b'0',
    PRIMARY KEY (`trip_photo_id`),
    INDEX `trip_photos_fk_2_idx` (`user_id` ASC) VISIBLE,
    INDEX `trip_photos_fk_1_idx` (`trip_id` ASC) VISIBLE,
    CONSTRAINT `trip_photos_fk_1`
      FOREIGN KEY (`trip_id`)
      REFERENCES `breakroutines`.`trips` (`trip_id`),
    CONSTRAINT `trip_photos_fk_2`
      FOREIGN KEY (`user_id`)
      REFERENCES `breakroutines`.`users` (`user_id`))
  ENGINE = InnoDB
  AUTO_INCREMENT = 7
  DEFAULT CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_0900_ai_ci;
  
  
  SET SQL_MODE=@OLD_SQL_MODE;
  SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
  SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
  