简体   繁体   中英

How can I set 'id' as biginteger and autoincrement in phinx for PostgreSQL?

I tried to set as only biginter but it lost its autoincrement properties. So I tried adding auto-increment as well.

$table->changeColumn('id', 'biginteger', ['identity' => true])->update();

But it showed error.

PDOException: SQLSTATE[42704]: Undefined object: 7 ERROR: type "bigserial" does not exist

How is this possible for PostgreSQL?

For MySQL this works in phinx 0.12

$table = $this->table('mytable', ['id' => false, 'primary_key' => 'id']);
$table->addColumn('id', 'biginteger', ['identity' => true, 'signed' => false])->create();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM