简体   繁体   中英

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 tothis you probably need it. It's an ID.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM