Domanda

When I use MySQL Workbench to Forward engineer my model to a work book, it creates a script file with the names of the tables in quotes. The table names are all in mixed case, but when the script runs, only the very first table is created with mixed case and the rest are created only in lower case. The first two tables out of 20+ are shown before:

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='TRADITIONAL,ALLOW_INVALID_DATES';

CREATE SCHEMA IF NOT EXISTS `CCBPlus` ;
USE `CCBPlus` ;

-- -----------------------------------------------------
-- Table `CCBPlus`.`Contacts`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `CCBPlus`.`Contacts` (
  `ContactId` INT(11) NOT NULL,
  `ContactType` BIT(3) NOT NULL COMMENT 'Contact Type: 0=Individual, 1=Corporate,   2=Family, 3=Branch, 4=Department, 5=Group, 6=Fund/GIC/Bank company',
  `DisplayName` VARCHAR(80) NOT NULL,
  `SearchName` VARCHAR(80) NOT NULL,
  `Prefix` VARCHAR(15) NULL DEFAULT NULL,
  `LastName` VARCHAR(50) NULL,
  `Initials` VARCHAR(10) NULL DEFAULT NULL,
  `FirstName` VARCHAR(40) NULL DEFAULT NULL,
  `Suffix` VARCHAR(10) NULL DEFAULT NULL,
  `OrganizationName` VARCHAR(50) NULL DEFAULT NULL,
  `InCareOf` VARCHAR(80) NULL COMMENT 'If mail is to be sent with the line \"In care of  [X]\"',
  `Birthdate` DATETIME NULL DEFAULT NULL,
  `Deceased` DATETIME NULL,
  `SocialSecurityNumber` VARCHAR(20) NULL DEFAULT NULL,
  `Gender` BIT(1) NULL DEFAULT 0 COMMENT '0=Male,1=Female',
  `CulturePreference` VARCHAR(10) NULL DEFAULT 'EN-CA' COMMENT 'Global Culture variable, e.g. EN-CA or FR-CA or other.',
  `LastMeeting` DATETIME NULL DEFAULT NULL,
  `Hobbies` VARCHAR(100) NULL,
  `Inactive` TINYINT(1) NOT NULL DEFAULT False,
  `Created` DATETIME NOT NULL,
  `LastModified` DATETIME NOT NULL,
  PRIMARY KEY (`ContactId`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COMMENT = 'Stores contact and optionally personal information for other' /* comment truncated */ /* entities. */;

-- -----------------------------------------------------
-- Table `CCBPlus`.`Branches`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `CCBPlus`.`Branches` (
  `BranchID` INT NOT NULL AUTO_INCREMENT,
  `Name` VARCHAR(50) NOT NULL COMMENT 'Unique name of this branch.',
  `Code` VARCHAR(4) NOT NULL COMMENT 'Internal code for the branch number.',
  `BranchContactId` INT NULL COMMENT 'Provides the address and contact information for  the branch.',
  `BranchManagerID` INT NULL COMMENT 'ID of the agent that manages this branch.',
  `PartnerDirectOfficerID` INT NULL COMMENT 'ID of the partner that is responsible for  this branch.',
  `HeadOffice` TINYINT(1) NOT NULL DEFAULT False COMMENT 'True if this branch is the head office.',
  `VirtualBranch` TINYINT(1) NOT NULL DEFAULT False COMMENT 'Indicates that this branch  is used only for organizational purposes and is not a real branch.',
  `Inactive` TINYINT(1) NOT NULL DEFAULT False COMMENT 'True if this branch is no longer in use.',
  PRIMARY KEY (`BranchID`),
  CONSTRAINT `fk_Branch_ContactInfo`
    FOREIGN KEY (`BranchContactId`)
    REFERENCES `CCBPlus`.`Contacts` (`ContactId`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_Branch_Manager`
    FOREIGN KEY (`BranchManagerID`)
    REFERENCES `CCBPlus`.`Agents` (`AgentID`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_Branch_PartnerDirectOfficer`
    FOREIGN KEY (`PartnerDirectOfficerID`)
    REFERENCES `CCBPlus`.`Agents` (`AgentID`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
COMMENT = 'Can represent a physical branch office, head office or a vir' /* comment truncated */ /*tual branch for organizational purposes.*/;
...

When the script is executed by MySQL Workbench, everything runs correctly, but I end up with one table with the correct cased: 'Contacts', and everything else with only lower case: 'branches'.

I have lower_case_table_names = 2.

I am running MySQL Workbench verson 6.0.9.11421 build 1170 with MySQL 5.1.72 Community version.

Any help or suggestions would be appreciated.

Thanks, Neil

È stato utile?

Soluzione

After reporting this bug to the MySQL developers, they came back with the suggestion that I set the lower case table names to zero:

lower_case_table_names = 0

This fixed the problem, when running on a Windows 7 development platform. BTW, renaming the tables manually totally screwed both my MySQL Workbench Model and my Entity Framework model. I had to resynch the Entity Framework Model with the database and manually match up the datastore tables with my entities again, and then hand-delete the extra tables and connections created.

Altri suggerimenti

CREATE TABLE IF NOT EXISTS `CCBPlus`.`Branches` (
.....
REFERENCES `CCBPlus`.`Agents` (`AgentID`) <--- the table `Agents`
                                           --not created before creating this table.
.....
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top