Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Cannot Reproduce
-
5.5.32
-
None
-
None
-
None
Description
I do an insert, we don't specify the id so it uses autoincrement.
INSERT INTO table_name (model, url, download_count, created_at, updated_at, user_id, asset_id) VALUES (?, ?, ?, ?, ?, ?, ?) |
with params ["value1", "aaaa, 1, "2013-09-02 07:33:11", "2013-09-02 18:47:16", 25595, 899]
It causes a duplicate entry: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5'
The status of the table is OK:
db_xxx.table_name check status OK
Here is the show create:
CREATE TABLE `table_name` ( |
`id` int(11) NOT NULL AUTO_INCREMENT, |
`user_id` int(11) DEFAULT NULL, |
`asset_id` int(11) DEFAULT NULL, |
`model` varchar(31) COLLATE utf8_unicode_ci NOT NULL, |
`url` varchar(127) COLLATE utf8_unicode_ci NOT NULL, |
`download_count` int(11) NOT NULL, |
`created_at` datetime NOT NULL, |
`updated_at` datetime NOT NULL, |
PRIMARY KEY (`id`), |
KEY `IDX_7A5DB31DA76ED395` (`user_id`), |
KEY `IDX_7A5DB31D5DA1941` (`asset_id`), |
CONSTRAINT `FK_7A5DB31D5DA1941` FOREIGN KEY (`asset_id`) REFERENCES `asset` (`id`), |
CONSTRAINT `FK_7A5DB31DA76ED395` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) |
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |