Issue #1 was incorrectly fixed imho. This is a solution that works for both:
CREATE TABLE `news_version` (
`version` int(11) NOT NULL AUTO_INCREMENT,
`id` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`content` text NOT NULL,
`author_id` int(11) NOT NULL,
`version_comment` varchar(255) NOT NULL,
`created_by` varchar(255) NOT NULL,
`created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`version`)
);
If "version" auto-increments, it will always be unique, thus there is no need for a composite primary key.
If it does not always increment (through special insert logic or similar), there is no need for auto-increment.
Ergo, do not use a composite primary key.
Issue #1 was incorrectly fixed imho. This is a solution that works for both:
If "version" auto-increments, it will always be unique, thus there is no need for a composite primary key.
If it does not always increment (through special insert logic or similar), there is no need for auto-increment.
Ergo, do not use a composite primary key.