mars47058 | salut a tous !
voila, j'ai bien lu le manuel mysql si dessous,
http://dev.mysql.com/doc/refman/5. [...] aints.html
http://dev.mysql.com/doc/refman/5. [...] aints.html
mais voila, mais clef étrangère ne marche pas !
alors, si quelqun a un instant pour tester ce script, et voir ou est l'erreur, ouest l'indice qui va pas, ca serait cool.
j'ai passé 3 heure dessus, et la, j'ai beau le lire, je vois rien !
Code :
- CREATE TABLE `has_claim` (
- `CLIENT_ID` int(10) unsigned NOT NULL default '0',
- `CLAIM_ID` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`CLIENT_ID`,`CLAIM_ID`),
- INDEX (`CLIENT_ID`,`CLAIM_ID`)
- ) TYPE=InnoDB;
- CREATE TABLE `is_insure` (
- `CLIENT_ID` int(10) unsigned NOT NULL default '0',
- `CONTRACT_TYPE` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`CLIENT_ID`,`CONTRACT_TYPE`),
- INDEX (`CLIENT_ID`,`CONTRACT_TYPE`)
- ) TYPE=InnoDB;
- CREATE TABLE `damage_type` (
- `DAMAGE_TYPE` int(10) unsigned NOT NULL default '0',
- `CAR_DAMAGE` decimal(10,0) default '1',
- `IMMATRICULATION_CAR_1` decimal(1,0) default '2',
- `IMMATRICULATION_CAR_2` decimal(1,0) default '3',
- `CIVIL_DAMAGE` decimal(1,0) NOT NULL default '0',
- `PRIVATE_RESPONSABILITY` decimal(1,0) default '5',
- `PETS_RESPONSABILITY` decimal(1,0) default '6',
- `BUILDER_RESPONSABILITY` decimal(1,0) default '7',
- `HOUSE_LANDOWNER_RESPONSABILITY` decimal(1,0) default '8',
- `FURNITURE_DAMAGE` decimal(1,0) default '9',
- `FIRE` decimal(1,0) default '10',
- `THUNDERSTORM` decimal(1,0) default '11',
- `ELEMENTARY` decimal(1,0) default '12',
- `GLASS_BRAKE` decimal(1,0) default '13',
- `WATTER` decimal(1,0) default '14',
- `BURGLARY` decimal(1,0) default '15',
- `HOUSE_DAMAGE` decimal(1,0) default '16',
- PRIMARY KEY (`DAMAGE_TYPE`),
- INDEX (`DAMAGE_TYPE`)
- ) TYPE=InnoDB COMMENT='InnoDB free: 4096 kB';
- CREATE TABLE `claim` (
- `CLAIM_ID` bigint(20) unsigned NOT NULL auto_increment,
- `CUSTOMER_ID` bigint(20) unsigned NOT NULL default '0',
- `CUSTOMER_NAME` varchar(64) NOT NULL default '',
- `CONTRACT_ID` bigint(20) unsigned NOT NULL default '0',
- `CLAIM_CATEGORY` varchar(64) NOT NULL default '',
- `CLAIM_DESCRIPTION` varchar(255) NOT NULL default '',
- `CLAIM_DATE` datetime NOT NULL default '0000-00-00 00:00:00',
- `DAMAGE_AMOUNT` decimal(2,0) NOT NULL default '0',
- `PICTURE` blob NOT NULL,
- `CLAIM_STATUS` varchar(16) NOT NULL default '',
- `ACTOR` varchar(45) NOT NULL default '',
- `DAMAGE_STREET` varchar(45) NOT NULL default '',
- `DAMAGE_HOUSE_NUMBER` decimal(4,0) NOT NULL default '0',
- `DAMAGE_TOWN` varchar(45) NOT NULL default '',
- `DAMAGE_TOWN_POST_CODE` decimal(5,0) NOT NULL default '0',
- `DAMAGE_TYPE` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`CLAIM_ID`),
- INDEX (`CLAIM_ID`,`DAMAGE_TYPE`)
- ) TYPE=InnoDB;
- CREATE TABLE `client` (
- `CLIENT_ID` int(10) unsigned NOT NULL auto_increment,
- `GENDER` decimal(1,0) NOT NULL default '0',
- `NAME` varchar(255) NOT NULL default '',
- `FAMILY_NAME` varchar(255) NOT NULL default '',
- `BIRTHDATE` datetime NOT NULL default '0000-00-00 00:00:00',
- `ADDRESS` varchar(255) NOT NULL default '',
- `HOUSE_NUMBER` decimal(4,0) NOT NULL default '0',
- `POST_CODE` decimal(5,0) NOT NULL default '0',
- `TOWN` varchar(255) NOT NULL default '',
- `PHONE1` decimal(15,0) NOT NULL default '0',
- `PHONE1_TIME_FROM` decimal(2,0) NOT NULL default '0',
- `PHONE1_TIME_TO` decimal(2,0) NOT NULL default '0',
- `PHONE2` decimal(15,0) NOT NULL default '0',
- `PHONE2_TIME_FROM` decimal(2,0) NOT NULL default '0',
- `PHONE2_TIME_TO` decimal(2,0) NOT NULL default '0',
- `EMAIL` varchar(150) NOT NULL default '',
- `CONTRACT_TYPE` decimal(1,0) NOT NULL default '0',
- PRIMARY KEY (`CLIENT_ID`),
- INDEX (`CLIENT_ID`)
- ) TYPE=InnoDB;
- CREATE TABLE `contract_type` (
- `CONTRACT_TYPE` int(10) unsigned NOT NULL auto_increment,
- `DESCRIPTION` varchar(255) NOT NULL default '',
- PRIMARY KEY (`CONTRACT_TYPE`),
- INDEX (`CONTRACT_TYPE`)
- ) TYPE=InnoDB;
- ALTER TABLE `csldev`.`damage_type` ADD CONSTRAINT `FK_damage_type_1` FOREIGN KEY `FK_damage_type_1` (`DAMAGE_TYPE`)
- REFERENCES `claim` (`DAMAGE_TYPE`)
- ON DELETE CASCADE
- ON UPDATE CASCADE;
- ALTER TABLE `csldev`.`is_insure` ADD CONSTRAINT `FK_is_insure_2` FOREIGN KEY (`CLIENT_ID`)
- REFERENCES `insured_client` (`CLIENT_ID`)
- ON DELETE CASCADE
- ON UPDATE CASCADE,
- ALTER TABLE `csldev`.`is_insure` ADD CONSTRAINT `FK_is_insure_1` FOREIGN KEY (`CLIENT_ID`)
- REFERENCES `insured_client` (`CLIENT_ID`)
- ON DELETE CASCADE
- ON UPDATE CASCADE;
- ALTER TABLE `csldev`.`has_claim` ADD CONSTRAINT `FK_has_claim_1` FOREIGN KEY `FK_has_claim_1` (`CLAIM_ID`)
- REFERENCES `claim` (`CLAIM_ID`)
- ON DELETE CASCADE
- ON UPDATE CASCADE,
- ADD CONSTRAINT `FK_has_claim_2` FOREIGN KEY `FK_has_claim_2` (`CLIENT_ID`)
- REFERENCES `client` (`CLIENT_ID`)
- ON DELETE CASCADE
- ON UPDATE CASCADE;
|
alors, une idée sur ces indices ?
Mars
|