1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
DROP TABLE IF EXISTS `type`;
CREATE TABLE `type` (
`id_type` int(4) NOT NULL AUTO_INCREMENT,
`text` text NOT NULL,
PRIMARY KEY (`id_type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `lang`;
CREATE TABLE `lang` (
`id_lang` int(4) NOT NULL AUTO_INCREMENT,
`name` text NOT NULL,
PRIMARY KEY (`id_lang`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE IF EXISTS `message`;
CREATE TABLE `message` (
`id_message` int NOT NULL,
`text` text NOT NULL,
`ref_type` int(4),
`ref_lang` int(2) NOT NULL,
FOREIGN KEY `FK_MESSAGE_TYPE` (`ref_type`) REFERENCES `type` (`id_type`),
PRIMARY KEY (`id_message`,`ref_lang`),
FOREIGN KEY `FK_MESSAGE_LANG` (`ref_lang`) REFERENCES `lang` (`id_lang`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `country`;
CREATE TABLE `country` (
`id_country` int(11) NOT NULL,
`ref_message` int(4) NOT NULL,
`country_code` char(2) NOT NULL,
PRIMARY KEY (`id_country`,`ref_message`),
FOREIGN KEY `FK_country_MESSAGE` (`ref_message`) REFERENCES `message` (`id_message`,`message.ref_lang`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
Partager