我尝试仅设置为biginter,但它失去了自动增量属性。所以我也尝试添加自动增量。
$table->changeColumn('id', 'biginteger', ['identity' => true])->update();
但是显示错误。
PDOException: SQLSTATE[42704]: Undefined object: 7 ERROR: type "bigserial" does not exist
这对于 PostgreSQL 来说怎么可能?
对于 MySQL,这适用于 phinx 0.12
$table = $this->table('mytable', ['id' => false, 'primary_key' => 'id']);
$table->addColumn('id', 'biginteger', ['identity' => true, 'signed' => false])->create();
尝试10种或更多方法后...
$this->table('usuario', ['id' => true, 'primary_key' => 'id'])
//$table->addColumn('id', 'biginteger', ['identity' => true])
//$table->addColumn('id', 'biginteger')
->addColumn('nome', 'string', ['limit' => 100])
....
并确保在配置文件中添加
'testing' => [
'adapter' => 'pgsql',
'host' => 'xxxx',
'name' => 'zzzz',
'user' => 'postgres',
'pass' => 'postgres',
'port' => '5432',
'charset' => 'utf8',
'schema' => 'public' <-- add this
]