Welcome Guest, Not a member yet? Register   Sign In
Foreign key and model relation
#1

How to add foreign key in table in table migration and hoe to do model relation?
Reply
#2

Try this

This works with new table
PHP Code:
$this->dbforge->add_field('CONSTRAINT FOREIGN KEY (id) REFERENCES table(id)'); 
This with existing table
PHP Code:
$this->dbforge->add_column('table',[
    
'CONSTRAINT fk_id FOREIGN KEY(id) REFERENCES table(id)',
]); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB