Welcome Guest, Not a member yet? Register   Sign In
Quick question: can I use composite primary keys?
#1

[eluser]Unknown[/eluser]
Is it possible to use composite primary keys in database tables with Code Igniter? I.e. there are multiple columns used as the primary key instead of a single ID column. I haven't been able to find any info on this in the docs or the forum search. Thanks!
#2

[eluser]Phil Sturgeon[/eluser]
Using CI makes no difference to your DB structure. If I get your meaning, you want primary ID's to be like 34-54 which is two ID's, saves on linking tables ,right?

If thats your point then yea of course you can do that Smile
#3

[eluser]Unknown[/eluser]
Yes, the table's ID would be made of the values from two or three different columns. This would ensure that no duplicate columns are created and save the space of making an ID column. I know that CakePHP's ORM forbids you from using tables with composite keys, so I just wanted to make sure that CI could interface with database tables that have composite IDs.




Theme © iAndrew 2016 - Forum software by © MyBB