开发者

MySQL Naming conventions

开发者 https://www.devze.com 2023-03-13 08:43 出处:网络
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开发者_如

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消