rado
Posts: 221
|
| Posted: 11/21/2008, 1:52 PM |
|
CREATE TABLE IF NOT EXISTS `rr_db`.`units` (
`unit_number` INT(10) UNSIGNED NOT NULL ,
`Properties_prop_id` INT(10) UNSIGNED NOT NULL ,
`unit_sqf` INT(10) UNSIGNED NULL ,
`unit_floor_number` INT(10) UNSIGNED NULL ,
`unit_number_of_rooms` INT(10) UNSIGNED NULL ,
`unit_key_number` INT(10) UNSIGNED NULL ,
`unit_number_of_bathrooms` INT(10) UNSIGNED NULL ,
`unit_service_loundry` BOOLEAN NULL ,
`unit_service_cable` BOOLEAN NULL ,
`unit_service_phone` BOOLEAN NULL ,
`unit_service_camera` BOOLEAN NULL ,
`unit_service_ac` BOOLEAN NULL ,
`unit_service_dishwasher` BOOLEAN NULL ,
`unit_service_parking` BOOLEAN NULL ,
`UnitTypes_unit_type_id` INT(10) UNSIGNED NOT NULL ,
PRIMARY KEY (`unit_number`, `Properties_prop_id`) ,
INDEX `fk_units_properties` (`Properties_prop_id` ASC) ,
INDEX `fk_units_unit_types` (`UnitTypes_unit_type_id` ASC) ,
CONSTRAINT `fk_units_properties`
FOREIGN KEY (`Properties_prop_id` )
REFERENCES `rr_db`.`properties` (`prop_id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_units_unit_types`
FOREIGN KEY (`UnitTypes_unit_type_id` )
REFERENCES `rr_db`.`unit_types` (`unit_type_id` )
ON DELETE RESTRICT
ON UPDATE CASCADE)
ENGINE = InnoDB
|