MySQL Naming conventions
I'm recreating this database (that I had originally made from django modelw) on an Amazon EC2 instance. I used MySQL workbench to translate the database into a mockup, and then had it forward开发者_如何学编程-engineer it to all the CREATE statements in a .sql file. However some of the foreign key stuff is named really strangely, and I'm not sure what parts I can take out or rename and what parts are necessary. Here's a sample of the code that I'm talking about.
CREATE TABLE IF NOT EXISTS `gamelydb`.`quotes` (
`id` INT(11) NOT NULL AUTO_INCREMENT ,
`game_id` INT(11) NOT NULL ,
`quotetext` VARCHAR(400) NOT NULL ,
`speaker_id` INT(11) NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `quotes_7b333d1e` (`game_id` ASC) ,
INDEX `quotes_7171bad0` (`speaker_id` ASC) ,
CONSTRAINT `game_id_refs_id_274910a8`
FOREIGN KEY (`game_id` )
REFERENCES `gamelydb`.`game` (`id` ),
CONSTRAINT `speaker_id_refs_id`
FOREIGN KEY (`speaker_id` )
REFERENCES `gamelydb`.`person` (`id` ))
ENGINE = InnoDB DEFAULT CHARACTER SET = latin1;
So like where it has "INDEX 'quotes_randomstuff'" or 'speaker_id_refs_id', do I need all the random stuff or what should I rename it to for clarity's/practicality's sake?
According to this you probably need it. It's an ID.
精彩评论