| Bug #77633 | multiple changes to a table in workbench don't apply | ||
|---|---|---|---|
| Submitted: | 6 Jul 2015 21:52 | ||
| Reporter: | Ben Krug | Email Updates: | |
| Status: | Won't Fix | Impact on me: | |
| Category: | MySQL Workbench: Administration | Severity: | S3 (Non-critical) |
| Version: | 6.2 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[14 Sep 18:02]
Omer Barnir
Posted by developer: This issue applies to the legacy MySQL Workbench 8.x implementation that is no longer supported or maintained. MySQL Workbench 26.7 is a complete rewrite using a new technology stack and does not use the affected legacy implementation. Therefore, this issue is not applicable to the current MySQL Workbench product and as such is closed.

Description: Changing a table name and a FK name, then clicking "apply" gives an error. Workbench tries to change the FK name using the old table name. How to repeat: 1. Execute: CREATE TABLE `Numbers` ( `Number` TINYINT NOT NULL, PRIMARY KEY (`Number`) ); CREATE TABLE `BadTableName` ( `RecordID` INT NOT NULL, `NumberID` TINYINT NOT NULL, CONSTRAINT `BadTableName_NumberID` FOREIGN KEY (`NumberID`) REFERENCES `Numbers` (`Number`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`RecordID`) ); 2. Right click "BadTableName", select "Alter Table". 3. Change "Table Name" field to "AmazingTable". 5. Click "Foreign Keys" tab and change "BadTableName_NumberID" to "AmazingTable_NumberID". 5. Click "Apply". 6. It fails ("Operation failed: There was an error while applying the SQL script to the database." and "ERROR 1146: Table 'test.badtablename' doesn't exist"). The SQL generated was : ALTER TABLE `test`.`badtablename` DROP FOREIGN KEY `BadTableName_NumberID`; ALTER TABLE `test`.`badtablename` RENAME TO `test`.`amazingtable` ; ALTER TABLE `test`.`badtablename` ADD CONSTRAINT `AmazingTable_NumberID` FOREIGN KEY (`NumberID`) REFERENCES `test`.`numbers` (`Number`) ON DELETE CASCADE ON UPDATE CASCADE; Suggested fix: take new earlier changes into account when generating later changes.