Monday, September 17, 2012

Sugestion for next versions

Since Mysql doesnt have a unique id for the whole database (all tables), just a unique id (auto increment) for each table, it would be nice if cake creates this. Like the fields created and modified wich are inserted automatically, maybe one more field called uid, wich uses the uniqueid() function from PHP to generate a real unique ID, wich will not conflict with any other table.

Where would it be usefull?

For example, if i have tags for producs, and tags for posts, i have to created a join table and the tags table for each table i want to use the tags. In the way i am using today (with my modified AppModel), i have only one join table and only one tags table for both tables (posts and products), and in the joinning i use from_uid and to_uid fields to relate them, works perfect, the products table has it´s uid field, wich will never conflicts with uid from posts table, because this value is always unique.

Maybe for a better understanding, the simple schema i´ve created explains better (Yes, i have only ONE join table for all HABTM relationships, using always "from_uid and to_uid" as foreignKey and association key)

[Table posts]
id (int)
title (varchar)
content (text)
uid (varchar)


[Table products]
id (int)
name (varchar)
description (text)
uid (varchar)

[Table tags]
id (int)
tag (varchar)
uid (varchar)

[Table join]
id (int)
from_uid (varchar)
to_uid (varchar)

So, what you people think about this?

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: