<![CDATA[ Strange problem : new MODx chunks are created with id=0 - My Forums]]> https://forums.modx.com/thread/?thread=102970 <![CDATA[Strange problem : new MODx chunks are created with id=0]]> https://forums.modx.com/thread/102970/strange-problem-new-modx-chunks-are-created-with-id-0#dis-post-554442
I have this strange issue on a MODX 1.0.15 website: when trying creating a new chunk, it gets a value of 0 for the id.
(The website is based on an existing website using YAMS, in which I imported records.)

I checked the table structure and was surprised that the id colum was not a primary key.
So, I set the column as Primary Key using phpMyAdmin.

After that, I applied these two SQL requests:
ALTER TABLE `modx_site_htmlsnippets` MODIFY COLUMN id INT auto_increment;
ALTER TABLE `modx_site_htmlsnippets` AUTO_INCREMENT = 87;

The AUTO_INCREMENT value was set to 87 because
SELECT MAX(id) FROM `modx_site_htmlsnippets`
returned 86.

Despite this, new chunks still receive id 0 and the following MODx parsing error is returned:
« MODX Parse Error »
MODX encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed - Duplicate entry '0' for key 'PRIMARY' »
SQL > INSERT INTO `somedatabase`.`modx_site_htmlsnippets` (`name`, `description`, `snippet`, `locked`, `category`) VALUES('hello', '', 'world', '0', '0')

Thank your for your help.]]>
Jul Oct 11, 2017, 08:38 AM https://forums.modx.com/thread/102970/strange-problem-new-modx-chunks-are-created-with-id-0#dis-post-554442