I connected successfully to an MySQL database then opened the OBJECTS tree, right clicked on a certain existing table and
selected
Scripts->Create Table Script
As result the following DDL code is generated in SQL editor:
> CREATE TABLE tbl_test
> (
> id bigint PRIMARY KEY NOT NULL,
> TOP_CHANGED_AT timestamp,
> TOP_CHANGED_BY varchar(255),
> TOP_CREATED_AT timestamp,
> TOP_CREATED_BY varchar(255),
> TOP_FINAL_TIMEOUT int
> )
> ;
> CREATE UNIQUE INDEX PRIMARY ON tbl_test(id)
> ;
Now I simply change the table name and append a "2", then I let the script run:
>CREATE TABLE tbl_test2
> (
> id bigint PRIMARY KEY NOT NULL,
> TOP_CHANGED_AT timestamp,
> TOP_CHANGED_BY varchar(255),
> TOP_CREATED_AT timestamp,
> TOP_CREATED_BY varchar(255),
> TOP_FINAL_TIMEOUT int
> )
> ;
>CREATE UNIQUE INDEX PRIMARY ON tbl_test2(id)
> ;
Much to my surprise I got errors:
Error: 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
'PRIMARY ON tbl_test2(id)' at line 1
SQLState: 42000
ErrorCode: 1064
Error occured in:
CREATE UNIQUE INDEX PRIMARY ON tbl_test2(id)
So Squirrels seems NOT to produce valid DDL CREATE TABLE scripts from existing tables..
Whats wrong?
Furthermore if I try to execute a simple
DROP TABLE tbl_test;
I got the following error:
Error: Cannot delete or update a parent row: a foreign key constraint fails
SQLState: 23000
ErrorCode: 1217
Why is it impossible to drop the existing table (including index)?
I am using MySQL 64bit MySQL v5.6.10
Ben
|