MySQL Forums
Forum List  »  MySQL Workbench

Forward engineering creates buggy code
Posted by: John King
Date: November 11, 2020 02:41PM

Forward engineering a EER generates buggy SQL code

ERROR: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VISIBLE,
CONSTRAINT `fk_witz_benutzer`



Complete script:
-- 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 m290_witze
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `m290_witze` ;

-- -----------------------------------------------------
-- Schema m290_witze
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `m290_witze` DEFAULT CHARACTER SET utf8 ;
USE `m290_witze` ;

-- -----------------------------------------------------
-- Table `m290_witze`.`benutzer`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `m290_witze`.`benutzer` (
`benutzer_id` INT UNSIGNED NOT NULL,
`benutzer_vorname` VARCHAR(45) NULL,
`benutzer_nachname` VARCHAR(45) NULL,
PRIMARY KEY (`benutzer_id`))
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `m290_witze`.`witz`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `m290_witze`.`witz` (
`witz_id` INT UNSIGNED NOT NULL,
`witz_text` VARCHAR(1000) NULL,
`benutzer_id` INT UNSIGNED NOT NULL,
PRIMARY KEY (`witz_id`),
INDEX `fk_witz_benutzer_idx` (`benutzer_id` ASC) VISIBLE,
CONSTRAINT `fk_witz_benutzer`
FOREIGN KEY (`benutzer_id`)
REFERENCES `m290_witze`.`benutzer` (`benutzer_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `m290_witze`.`bewertung`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `m290_witze`.`bewertung` (
`benutzer_id` INT NOT NULL,
`witz_id` INT NOT NULL,
`bewertung_sternen` TINYINT(1) NULL COMMENT '1 = mëh\n2 = soso\n3 = ok\n4 = nicht slecht\n5 = hammer',
PRIMARY KEY (`benutzer_id`, `witz_id`),
INDEX `fk_benutzer_has_witz_witz1_idx` (`witz_id` ASC) VISIBLE,
INDEX `fk_benutzer_has_witz_benutzer1_idx` (`benutzer_id` ASC) VISIBLE,
CONSTRAINT `fk_benutzer_has_witz_benutzer1`
FOREIGN KEY (`benutzer_id`)
REFERENCES `m290_witze`.`benutzer` (`benutzer_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_benutzer_has_witz_witz1`
FOREIGN KEY (`witz_id`)
REFERENCES `m290_witze`.`witz` (`witz_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

Options: ReplyQuote


Subject
Views
Written By
Posted
Forward engineering creates buggy code
53
November 11, 2020 02:41PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.