CodeIgniter Forums
Can active record be set to use uuid instead of autoincrement automatically for the pk? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Can active record be set to use uuid instead of autoincrement automatically for the pk? (/thread-16254.html)



Can active record be set to use uuid instead of autoincrement automatically for the pk? - El Forum - 03-01-2009

[eluser]Unknown[/eluser]
I'm noting a few posts that say to use uuid for the id directly in sql but is there a way to have active record do it automatically?

Thanks!
Andre


Can active record be set to use uuid instead of autoincrement automatically for the pk? - El Forum - 03-01-2009

[eluser]pistolPete[/eluser]
Does this work?
http://ellislab.com/forums/viewreply/460729/


Can active record be set to use uuid instead of autoincrement automatically for the pk? - El Forum - 03-02-2009

[eluser]Unknown[/eluser]
Thanks PistolPete,

Thats in fact the post I hinted at. This solution (I havent tested it yet) requires slightly more work, The code is then not interchangeable with a schema using ints and autoincrements.

I prefer using uuids for data portability and guaranteed uniqueness and was comparing against cakephp where the system automatically does it if you declare your id field as being char 26 (which is technically not uuid but works)(which is pretty cool).

I guess I'll look and see how easy it would be to update the active record files.

Andre