Aargh...name conventions, still not used to it. Thanks for the heads up, knew it had to be something obvoius. It always is ;)) Now it works like a charm.
-- Zoran Kovac 091/ 588 6175 V.Gorica On Fri, Jul 17, 2009 at 9:53 AM, Carlos Lavin <carloslavi...@gmail.com>wrote: > Tables are supposed to be plural (users,groups,medicinal_devices) and the > foreign keys singular(user_id,group_id...) > Change it and give it another shot =) > > 2009/7/17 Zoran Kovac <zoko2...@gmail.com> > >> 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 < >> carloslavi...@gmail.com> wrote: >> >>> Maybe if you described the tables' fields.. theres gotta be some >>> convention breaking there >>> >>> 2009/7/16 Zoran Kovac <zoko2...@gmail.com> >>> >>>> >>>> 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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---