コード例 #1
0
ファイル: AdapterTest.php プロジェクト: azema/phigrate
 public function testRemoveForeignKeyWithEngineMyisam()
 {
     //create it
     $engine = 'MyISAM';
     $sql = "CREATE TABLE `users` (name varchar(20), address varchar(25), title varchar(20), other tinyint(1)) ENGINE={$engine};";
     $this->object->executeDdl($sql);
     $sql = "CREATE TABLE `addresses` (name varchar(25), street varchar(20)) ENGINE={$engine};";
     $this->object->executeDdl($sql);
     $this->assertFalse($this->object->isPrimaryKey('addresses', 'name'));
     $this->assertFalse($this->object->hasIndex('addresses', 'name'));
     $this->assertFalse($this->object->hasIndex('users', 'address', array('name' => 'users_ibfk_address')));
     try {
         $this->object->removeForeignKey('users', 'address', 'addresses', 'name');
         $this->fail('The engine of tables does not support the foreign key constraints!');
     } catch (Phigrate_Exception_InvalidTableDefinition $ex) {
         $msg = $engine . ' does not supports foreign key constraints.';
         $this->assertEquals($msg, $ex->getMessage());
     }
 }