orm
orm copied to clipboard
Unable to use custom type in migrations
I want to use GENERATED ALWAYS AS IDENTITY type instead of serial. Now I can't find any way to use it. Here is my sample migration (don't work now)
class InitMigration extends Migration
{
public function up()
{
$this->table('users')
->addColumn('id', 'INTEGER GENERATED ALWAYS AS IDENTITY', [
'nullable' => false,
])
->addColumn('email', 'string', [
'nullable' => false,
'size' => 250
])
->create();
}
public function down()
{
$this->table('users')->drop();
}
}
Is there any way to create IDENTITY column instead of serial?
The identity columns might be not supported via declarative form. Try using native queries. We will extend declarative builder to support user types later.
$this->database()->execute();