php - MySQL InnoDB auto increment column based on combination of other columns -
i making system users can upload file want, , not use execute kind of code. part of that, rename every file, , store original name in mysql table. table contains id of user uploaded it, , unique id of upload. doing this:
create table `uploads` ( `user_id` int(11) not null, `upload_id` int(11) not null auto_increment, `original_name` varchar(30) not null, `mime_type` varchar(30) not null, `name` varchar(50) not null, primary key (`user_id`, `upload_id`) ) engine=myisam;
this means have unique combination of user_id , upload_id, , every users first upload has id of 1. heard myisam old, , should rather use innodb. there way can achieve in innodb?
the biggest problem myisam tables not transactional. say, creating records , reading them (possibly deleting them later) there little or no editing. situation myisam designed for, fast read records. see no advantage converting innodb.
Comments
Post a Comment