danielhep
danielhep

Reputation: 356

MySQL Workbench schema synchronization causing error 1064

I'm using MySQL Workbench to try to create a schema for my database. When I try to sync it up to the server, I'm getting an error 1064. Here's the full log:

Executing SQL script in server
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,
  PRIMARY KEY (`id`),
  CONSTRAINT `buildings_rel`
    FOREIGN KEY (`bu' at line 10
SQL Code:
        CREATE TABLE IF NOT EXISTS `rentals`.`apartments` (
          `beds` INT(11) NOT NULL,
          `baths` INT(11) NOT NULL,
          `area` INT(11) NOT NULL,
          `price_min` INT(11) NOT NULL,
          `price_max` INT(11) NOT NULL,
          `available_now` BIT(1) NOT NULL,
          `building_id` INT(11) NULL DEFAULT NULL,
          `id` INT(11) NOT NULL AUTO_INCREMENT,
          INDEX `buildings_rel_idx` (`building_id` ASC) VISIBLE,
          PRIMARY KEY (`id`),
          CONSTRAINT `buildings_rel`
            FOREIGN KEY (`building_id`)
            REFERENCES `rentals`.`buildings` (`id`)
            ON DELETE NO ACTION
            ON UPDATE NO ACTION)
        ENGINE = InnoDB
        DEFAULT CHARACTER SET = utf8

I don't really know SQL so I'm having trouble figuring out what exactly is wrong here. I expected the Workbench to create correct code, I'm a little surprised that it seems to be this glitchy. Any help appreciated, thank you.

Upvotes: 2

Views: 1150

Answers (2)

Harsha Jayamanna
Harsha Jayamanna

Reputation: 2258

Change the Default Target MySQL Version to match your mysql version.

Home -> Edit -> Preferences -> Modeling -> MySQL -> Default Target MySQL Version

enter image description here

Upvotes: 0

danielhep
danielhep

Reputation: 356

Got it! As some of the commentors said, I had to set a different target version in the MySQL Workbench settings. Thanks!

Upvotes: 1

Related Questions