Welcome Guest, Not a member yet? Register   Sign In
question in the dbforge class
#1

[eluser]Mr-H[/eluser]
hi every body
i want to creat a table in the phpmyadmin with the dbforge class using UNIQUE key.
but in the user guide nothing pointed to that, it said that i can creat a primary key using:
Code:
$this->dbforge->add_key('id',true);
and creat key "what kind of key? i dont know" by puting this;
Code:
$this->dbforge->add_key('test');
so when i run the code i got the id as primary, and test as index" by default i think".
so my question is how can i creat the test field as Unique key.
thanks for reading
#2

[eluser]Mr-H[/eluser]
up
#3

[eluser]KingSkippus[/eluser]
Looking at the documentation, I do not think there is a way to create a unique index on a column using dbforge. You can just run a query like the one below to create one, though:

Code:
CREATE UNIQUE INDEX IDX_test ON table_name (test);




Theme © iAndrew 2016 - Forum software by © MyBB