Here are some of the table fields. it's the table USER, GROUPS and MEDICIANL
DEVICE.
In short relatons are: ser should be in one group and have many MedDevice,
group should have one user, medicinal
device should have only one user.


CREATE  TABLE IF NOT EXISTS `baza2`.`USER` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `UserName` VARCHAR(45) NULL ,
  `Password` VARCHAR(45) NULL COMMENT '
                                    ' ,
  `Surname` VARCHAR(45) NULL ,
  `Name` VARCHAR(45) NULL ,
  `groups_id` INT NULL ,
  PRIMARY KEY (`id`) ,
  INDEX `fk_USER_GROUPS` (`groups_id` ASC) ,
  CONSTRAINT `fk_USER_GROUPS`
    FOREIGN KEY (`groups_id` )
    REFERENCES `baza2`.`GROUPS` (`id` )
    ON DELETE CASCADE
    ON UPDATE CASCADE)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `baza2`.`MANUFACTURER`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `baza2`.`MANUFACTURER` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `Name` VARCHAR(45) NULL ,
  `Address` VARCHAR(45) NULL ,
  `Phone` VARCHAR(45) NULL ,
  `Contact` VARCHAR(45) NULL ,
  `Mail` VARCHAR(45) NULL ,
  `user_id` INT NULL ,
  PRIMARY KEY (`id`) ,
  INDEX `fk_MANUFACTURER_USER` (`user_id` ASC) ,
  CONSTRAINT `fk_MANUFACTURER_USER`
    FOREIGN KEY (`user_id` )
    REFERENCES `baza2`.`USER` (`id` )
    ON DELETE CASCADE
    ON UPDATE CASCADE)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `baza2`.`MEDICINAL_DEVICE`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `baza2`.`MEDICINAL_DEVICE` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `Name` VARCHAR(45) CHARACTER SET 'big5' COLLATE 'big5_chinese_ci' NULL
COMMENT '                        ' ,
  `ActiveIng` VARCHAR(45) NULL ,
  `PharmaForm` VARCHAR(45) NULL ,
  `RouteAdministration` VARCHAR(45) NULL ,
  `DailyDose` VARCHAR(45) NULL ,
  `user_id` INT NULL ,
  `manufacturer_id` INT NULL ,
  PRIMARY KEY (`id`) ,
  INDEX `fk_MEDICINAL_DEVICE_USER` (`user_id` ASC) ,
  INDEX `fk_MEDICINAL_DEVICE_MANUFACTURER` (`manufacturer_id` ASC) ,
  CONSTRAINT `fk_MEDICINAL_DEVICE_USER`
    FOREIGN KEY (`user_id` )
    REFERENCES `baza2`.`USER` (`id` )
    ON DELETE CASCADE
    ON UPDATE CASCADE,
  CONSTRAINT `fk_MEDICINAL_DEVICE_MANUFACTURER`
    FOREIGN KEY (`manufacturer_id` )
    REFERENCES `baza2`.`MANUFACTURER` (`id` )
    ON DELETE CASCADE
    ON UPDATE CASCADE)
ENGINE = InnoDB;


On Thu, Jul 16, 2009 at 4:02 PM, Carlos Gonzalez Lavin <
[email protected]> wrote:

> Maybe if you described the tables' fields.. theres gotta be some convention
> breaking there
>
> 2009/7/16 Zoran Kovac <[email protected]>
>
>>
>> Hi!
>>
>> I'm having a dilema, maybe the better word is that I'm puzzled.
>>
>> The problem is when I'm baking models. The console doesn't detect
>> relations between tables automatically. For instance, the console does
>> recognize all the tables from the database, but when it's triying to
>> detect associations it comes up with the result like on the end of
>> this post or just skips to 'Look okay?'. It the noted example on end
>> of the post, I manage to create a complete model (with association to
>> user), but association among other models fails.
>>
>> So my question's are:
>>
>> 1. Am I breaking some convetions and it's not working?
>> 2. Could it be that I'm using InnoDB type?
>> 3. Anything else?
>>
>> Any kind of sugestions is appreciated. Thnx.
>>
>>
>> Possible Models based on your current database:
>> 1. DocumentsDevice
>> 2. Group
>> 3. InvestigationalSite
>> 4. Investigator
>> 5. Manufacturer
>> 6. MedicinalDevice
>> 7. MedicinalProduct
>> 8. ReportDevice
>> 9. ReportProduct
>> 10. SoaDevice
>> 11. SoaProduct
>> 12. User
>> Enter a number from the list above, type in the name of another model,
>> or 'q' to
>>  exit
>> [q] > 2
>> Would you like to supply validation criteria for the fields in your
>> model? (y/n)
>>
>> [y] > n
>> Would you like to define model associations (hasMany, hasOne,
>> belongsTo, etc.)?
>> (y/n)
>> [y] > y
>> One moment while the associations are detected.
>> ---------------------------------------------------------------
>> Please confirm the following associations:
>> ---------------------------------------------------------------
>> Would you like to define some additional model associations? (y/n)
>> [n] >
>>
>> ------------------------------------------------------------------------------------------------------------------------
>>
>>
>>
>>
>
> >
>


-- 
Zoran Kovac
091/ 588 6175
V.Gorica

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to