Skip to content

Conversation

@captain-redbeard
Copy link
Contributor

This pull request implements the discussed changes in 2193.

Changes

  • Set's the default generated clause to GENERATED BY DEFAULT to allow database seeding with the OOTB setup.
  • Updates the PostgresAdapter insert statements to include OVERRIDING SYSTEM VALUE to allow inserting into columns that were created with the GENERATED ALWAYS clause. This allows database seeding.

How to set GENERATED ALWAYS

In your migration file add the option generated.

...

public function up()
{
    $this->table('my_table')
        ->addColumn('id', 'integer', [
            'autoIncrement' => true,
            'limit' => 11,
            'generated' => \Phinx\Db\Adapter\PostgresAdapter::GENERATED_ALWAYS,
          ])
          ...
}

@ajibarra
Copy link
Member

It looks good @captain-redbeard 👍. Let's wait for a maintainer to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants