Guest User

Untitled

a guest
Apr 2nd, 2019
94
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- MySQL Script generated by MySQL Workbench
  2. -- Tue Apr 2 16:43:00 2019
  3. -- Model: New Model Version: 1.0
  4. -- MySQL Workbench Forward Engineering
  5.  
  6. SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
  7. SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
  8. SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
  9.  
  10. -- -----------------------------------------------------
  11. -- Schema mydb
  12. -- -----------------------------------------------------
  13. DROP SCHEMA IF EXISTS `mydb` ;
  14.  
  15. -- -----------------------------------------------------
  16. -- Schema mydb
  17. -- -----------------------------------------------------
  18. CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ;
  19. USE `mydb` ;
  20.  
  21. -- -----------------------------------------------------
  22. -- Table `mydb`.`marca`
  23. -- -----------------------------------------------------
  24. CREATE TABLE IF NOT EXISTS `mydb`.`marca` (
  25. `idMarca` INT NOT NULL AUTO_INCREMENT,
  26. `detMarca` VARCHAR(45) NOT NULL,
  27. PRIMARY KEY (`idMarca`))
  28. ENGINE = InnoDB;
  29.  
  30.  
  31. -- -----------------------------------------------------
  32. -- Table `mydb`.`modelo`
  33. -- -----------------------------------------------------
  34. CREATE TABLE IF NOT EXISTS `mydb`.`modelo` (
  35. `idModelo` INT NOT NULL AUTO_INCREMENT,
  36. `detModelo` VARCHAR(45) NOT NULL,
  37. `idMarca_FK` INT NOT NULL,
  38. PRIMARY KEY (`idModelo`),
  39. INDEX `fk_modelo_marca_idx` (`idMarca_FK` ASC),
  40. CONSTRAINT `fk_modelo_marca`
  41. FOREIGN KEY (`idMarca_FK`)
  42. REFERENCES `mydb`.`marca` (`idMarca`)
  43. ON DELETE NO ACTION
  44. ON UPDATE NO ACTION)
  45. ENGINE = InnoDB;
  46.  
  47.  
  48. -- -----------------------------------------------------
  49. -- Table `mydb`.`conector`
  50. -- -----------------------------------------------------
  51. CREATE TABLE IF NOT EXISTS `mydb`.`conector` (
  52. `idConector` INT NOT NULL AUTO_INCREMENT,
  53. `detConector` VARCHAR(45) NOT NULL,
  54. PRIMARY KEY (`idConector`))
  55. ENGINE = InnoDB;
  56.  
  57.  
  58. -- -----------------------------------------------------
  59. -- Table `mydb`.`conector_x_modelo`
  60. -- -----------------------------------------------------
  61. CREATE TABLE IF NOT EXISTS `mydb`.`conector_x_modelo` (
  62. `idConector_FK` INT NOT NULL,
  63. `idModelo_FK` INT NOT NULL,
  64. PRIMARY KEY (`idConector_FK`, `idModelo_FK`),
  65. INDEX `fk_conector_has_modelo_modelo1_idx` (`idModelo_FK` ASC),
  66. INDEX `fk_conector_has_modelo_conector1_idx` (`idConector_FK` ASC),
  67. CONSTRAINT `fk_conector_has_modelo_conector1`
  68. FOREIGN KEY (`idConector_FK`)
  69. REFERENCES `mydb`.`conector` (`idConector`)
  70. ON DELETE NO ACTION
  71. ON UPDATE NO ACTION,
  72. CONSTRAINT `fk_conector_has_modelo_modelo1`
  73. FOREIGN KEY (`idModelo_FK`)
  74. REFERENCES `mydb`.`modelo` (`idModelo`)
  75. ON DELETE NO ACTION
  76. ON UPDATE NO ACTION)
  77. ENGINE = InnoDB;
  78.  
  79.  
  80. SET SQL_MODE=@OLD_SQL_MODE;
  81. SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
  82. SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
RAW Paste Data