Error - Foreign keys on create_table() must specify a reference table and column name in COREPATH/classes/dbutil.php on line 381
<?php
namespace Fuel\Migrations;
class Initial_db_model
{
function up()
{
// Create table `organizations`
\DBUtil::create_table('organizations', array(
'id' => array('type' => 'int', 'constraint' => 5, 'auto_increment' => true),
'apikey' => array('type' => 'varchar', 'constraint' => 32),
'system_uri' => array('type' => 'text'),
'name' => array('type' => 'varchar', 'constraint' => 45),
'active' => array('type' => 'boolean'),
'created_at' => array('type' => 'timestamp', 'detault' => \DB::expr('CURRENT_TIMESTAMP')),
'updated_at' => array('type' => 'timestamp', 'null' => true)
), array('id'));
\DBUtil::create_index('organizations', 'apikey', 'apikey_UNIQUE', 'UNIQUE');
\DBUtil::create_index('organizations', 'apikey', 'apikey_INDEX');
// Create table `shops`
\DBUtil::create_table('shops', array(
'id' => array('type' => 'varchar', 'constraint' => 32),
'active' => array('type' => 'boolean'),
'name' => array('type' => 'varchar', 'constraint' => 45),
'created_at' => array('type' => 'timestamp', 'detault' => \DB::expr('CURRENT_TIMESTAMP')),
'updated_at' => array('type' => 'timestamp', 'null' => true)
), array('id'), true, false, null, array(
'key' => 'organizations_id',
'reference' => array(
'table' => 'organizations',
'column' => 'id')
)
);
}
function down()
{
\DBUtil::drop_table('shops');
\DBUtil::drop_table('organizations');
}
}
It looks like you're new here. If you want to get involved, click one of these buttons!