有人可以帮我添加外键和Codeigniter迁移数据库吗?
这是代码:
原文链接:https://www.f2er.com/php/137126.html这是代码:
public function up() { $this->dbforge->add_field(array( 'ID_PELAYANAN' => array( 'type' => 'INT','constraint' => 50,'auto_increment' => TRUE ),'THBLMUT' => array( 'type' => 'VARCHAR','constraint' => '6',),'ID_DIST' => array( 'type' => 'VARCHAR','constraint' => '2','ID_AREA' => array( 'type' => 'VARCHAR','constraint' => '5','ID_RAYON' => array( 'type' => 'VARCHAR','N_RAYON' => array( 'type' => 'CHAR','constraint' => '70',)); $this->dbforge->add_key('ID_PELAYANAN',TRUE); $this->dbforge->create_table('pelayanan'); } public function down() { $this->dbforge->drop_table('pelayanan'); } }
我想在此表中将’ID_AREA’,’ID_RAYON’作为Forein Key.我该如何解决这个问题?