Exemplo n.º 1
0
 /**
  * Test generating a column that is a primary key.
  *
  * @return void
  */
 public function testColumnSqlPrimaryKey()
 {
     $driver = $this->_getMockedDriver();
     $schema = new MysqlSchema($driver);
     $table = new Table('articles');
     $table->addColumn('id', ['type' => 'integer', 'null' => false])->addConstraint('primary', ['type' => 'primary', 'columns' => ['id']]);
     $result = $schema->columnSql($table, 'id');
     $this->assertEquals($result, '`id` INTEGER NOT NULL AUTO_INCREMENT');
     $table = new Table('articles');
     $table->addColumn('id', ['type' => 'biginteger', 'null' => false])->addConstraint('primary', ['type' => 'primary', 'columns' => ['id']]);
     $result = $schema->columnSql($table, 'id');
     $this->assertEquals($result, '`id` BIGINT NOT NULL AUTO_INCREMENT');
 }