Script generation auto_increment bug
When backing up a database or creating CREATE script from a table, the auto_increment attribute is not set on a column which is not defined as a primary key.
eg.
CREATE TABLE wpquestionsformelement (
elementid int(11) NOT NULL AUTOINCREMENT,
formid int(11) NOT NULL,
elementorder int(11) NOT NULL,
elementtypecode varchar(50) NOT NULL,
elementparams varchar(3000) DEFAULT NULL,
questionid int(11) DEFAULT NULL,
attachmentid int(11) DEFAULT NULL,
mandatory bit(1) NOT NULL DEFAULT b'0',
deletedflag tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (formid, elementorder),
INDEX idxwpquestionsformelementelementid (elementid)
)
ENGINE = INNODB,
AUTOINCREMENT = 262150,
AVGROWLENGTH = 76,
CHARACTER SET latin1,
COLLATE latin1swedishci;
When creating the script dbForge omits the auto_increment attribute as follows:
CREATE TABLE wpquestionsformelement (
elementid int(11) NOT NULL,
formid int(11) NOT NULL,
elementorder int(11) NOT NULL,
elementtypecode varchar(50) NOT NULL,
elementparams varchar(3000) DEFAULT NULL,
questionid int(11) DEFAULT NULL,
attachmentid int(11) DEFAULT NULL,
mandatory bit(1) NOT NULL DEFAULT b'0',
deletedflag tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (formid, elementorder)
)
ENGINE = INNODB,
AUTOINCREMENT = 262150,
AVGROWLENGTH = 76,
CHARACTER SET latin1,
COLLATE latin1swedishci;
--
-- Create index idx_wp_questions_form_element_elementid
on table wp_questions_form_element
ALTER TABLE wpquestionsformelement
ADD INDEX idxwpquestionsformelementelementid (elementid);
This happens for all entities which have autoincrement columns defined in informationschema.columns with a COLUMN_KEY = MUL