Re: UUID or INT and association problems
you might want to consider using char(36) instead On 19 Jan., 14:43, jjw wrote: > If I'm using the uuid as the id field, then I do something like this: > parents > id varchar(36) > other fields > > children > id varchar(36) > parent_id varchar(36) > > Basically all that is different in the DB is the id field is a varchar > rather then INT > > However, generally I am using int fields for the id, and create a > second field for uuid only on tables that need to be synced between > other servers and clients. > > parents > id int > uuid varchar(36) > other fields > > children > id int > uuid varchar(36) > parent_id int > > On Jan 18, 4:17 am, Pehmolelu wrote: > > > > > > > > > Im defining a completely new database. I have now faced a problem > > which I would describe as "usual" but still could not find good > > information from web. So here's the problem: > > > I have many guide tables in database such as: > > Skills > > Places > > Activities > > and so on... > > > Now to all these guide types I'd like to add a comment feature and > > other similar features. I have many guide types so I dropped the idea > > of having separate comment table for each of them. I need one comment > > table. > > > The question is, what is the best way to achieve this? > > > I understand what UUIDs are but I dont understand how they actually > > work in database with Cakephp or how they are even used. > > > Here's how I thought it works but dont know if its right way and is it > > how UUIDs are used (or if it is right at all): > > > Create a new table: Guides which could have UUID field > > Then link all those guide types to (Guide as parent and the other as > > child) > > Parent and Child have both UUID fields and when creating a guide > > Parent and Child gets same UUID so they can be linked. > > Then link comments to Guides by using UUID field that points to Guide > > plus seperate id int field for comments.. > > > Please tell me if this is correct way or is it total garbage and if > > so, how I should do it? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: UUID or INT and association problems
If I'm using the uuid as the id field, then I do something like this: parents idvarchar(36) other fields children idvarchar(36) parent_id varchar(36) Basically all that is different in the DB is the id field is a varchar rather then INT However, generally I am using int fields for the id, and create a second field for uuid only on tables that need to be synced between other servers and clients. parents id int uuid varchar(36) other fields children id int uuid varchar(36) parent_idint On Jan 18, 4:17 am, Pehmolelu wrote: > Im defining a completely new database. I have now faced a problem > which I would describe as "usual" but still could not find good > information from web. So here's the problem: > > I have many guide tables in database such as: > Skills > Places > Activities > and so on... > > Now to all these guide types I'd like to add a comment feature and > other similar features. I have many guide types so I dropped the idea > of having separate comment table for each of them. I need one comment > table. > > The question is, what is the best way to achieve this? > > I understand what UUIDs are but I dont understand how they actually > work in database with Cakephp or how they are even used. > > Here's how I thought it works but dont know if its right way and is it > how UUIDs are used (or if it is right at all): > > Create a new table: Guides which could have UUID field > Then link all those guide types to (Guide as parent and the other as > child) > Parent and Child have both UUID fields and when creating a guide > Parent and Child gets same UUID so they can be linked. > Then link comments to Guides by using UUID field that points to Guide > plus seperate id int field for comments.. > > Please tell me if this is correct way or is it total garbage and if > so, how I should do it? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
UUID or INT and association problems
Im defining a completely new database. I have now faced a problem which I would describe as "usual" but still could not find good information from web. So here's the problem: I have many guide tables in database such as: Skills Places Activities and so on... Now to all these guide types I'd like to add a comment feature and other similar features. I have many guide types so I dropped the idea of having separate comment table for each of them. I need one comment table. The question is, what is the best way to achieve this? I understand what UUIDs are but I dont understand how they actually work in database with Cakephp or how they are even used. Here's how I thought it works but dont know if its right way and is it how UUIDs are used (or if it is right at all): Create a new table: Guides which could have UUID field Then link all those guide types to (Guide as parent and the other as child) Parent and Child have both UUID fields and when creating a guide Parent and Child gets same UUID so they can be linked. Then link comments to Guides by using UUID field that points to Guide plus seperate id int field for comments.. Please tell me if this is correct way or is it total garbage and if so, how I should do it? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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