Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 2193 Postgres GENERATED ALWAYS #2195

Merged

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