Closed sorinpohontu closed 13 years ago
You open up the migration before it is run and add that if you like. Scaffolding is for creating basic code nice and quickly, not super-mega optmised for MySQL-specific code.
Change the migration, change the model, done.
Let's say we have 2 tables, linked with a Foreign Key.
CREATE TABLE
cities
(id
int(11) NOT NULL AUTO_INCREMENT,name
varchar(255) NOT NULL,created_at
int(11) NOT NULL,updated_at
int(11) NOT NULL, PRIMARY KEY (id
) ) ENGINE=InnoDB;CREATE TABLE
users
(id
int(11) NOT NULL AUTO_INCREMENT,name
varchar(255) NOT NULL,city_id
int(11) NOT NULL,created_at
int(11) NOT NULL,updated_at
int(11) NOT NULL, PRIMARY KEY (id
), CONSTRAINTusers_ibfk_0
FOREIGN KEY (city_id
) REFERENCEScities
(id
) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB;Issues:
I have opened a forum post for this: http://fuelphp.com/forums/topics/view/4315
Regards, /Sorin