コード例 #1
0
 public function test_ensure_table_does_exist()
 {
     //first make sure the table does not exist
     $users = $this->adapter->has_table('users', true);
     $this->assertEquals(false, $users);
     //create it
     //$this->adapter->execute_ddl("CREATE TABLE `users` ( name varchar(20) );");
     $t1 = new MySQLTableDefinition($this->adapter, "users", array('options' => 'Engine=InnoDB'));
     $t1->column("name", "string", array('limit' => 20));
     $sql = $t1->finish();
     //now make sure it does exist
     $users = $this->adapter->table_exists('users', true);
     $this->assertEquals(true, $users);
 }
コード例 #2
0
 public function test_generate_table_without_primary_key()
 {
     $t1 = new MySQLTableDefinition($this->adapter, "users", array('id' => false, 'options' => 'Engine=InnoDB'));
     $t1->column("first_name", "string");
     $t1->column("last_name", "string", array('limit' => 32));
     $actual = $t1->finish();
     $col = $this->adapter->column_info("users", "id");
     $this->assertEquals(null, $col);
 }