When I insert a new row the treeId column is always 1.
The treeId column is not included in the insert statement.
What could be causing it to not increment?
My table code is
CREATE TABLE `users` (
`uuid` varchar(36) NOT NULL,
`parentUuid` varchar(36) DEFAULT NULL,
`treePath` text,
`treeId` int(11) NOT NULL AUTO_INCREMENT,
`firstName` varchar(50) NOT NULL,
`lastName` varchar(50) NOT NULL,
`email` varchar(255) NOT NULL,
`salt` varchar(40) NOT NULL,
`password` varchar(40) NOT NULL,
`state` enum('subscribed','registered','banned') NOT NULL,
`dobMonth` int(11) DEFAULT NULL,
`dobYear` int(11) DEFAULT NULL,
`dateSubscribed` datetime DEFAULT NULL,
`dateRegistered` datetime DEFAULT NULL,
`gender` enum('unspecified','male','female') NOT NULL DEFAULT 'unspecified',
`dd` float DEFAULT '0',
`mainRegion` int(11) DEFAULT NULL,
PRIMARY KEY (`uuid`,`treeId`),
KEY `parentid` (`parentUuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Found the answer (Documentation)
So because I had a joint key on
uuid(which is always unique) and on treeId (which is the auto-increment) then it was creating a new increment group each time.