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

[PGsql] Index should be primary key , instead of Normal Index #112

Closed
yassinrais opened this issue Apr 23, 2021 · 4 comments · Fixed by #116
Closed

[PGsql] Index should be primary key , instead of Normal Index #112

yassinrais opened this issue Apr 23, 2021 · 4 comments · Fixed by #116
Assignees
Labels
bug Something isn't working PostgreSQL
Milestone

Comments

@yassinrais
Copy link

yassinrais commented Apr 23, 2021

Table company

 'indexes' => [
                    new Index('pk_company_id_0', ['id'], 'PRIMARY'),
                    new Index('unq_company_country_id', ['country_id', 'name'] ,'UNIQUE')
                ],

After runing migration
image

@Jeckerson Jeckerson added PostgreSQL bug Something isn't working labels Apr 24, 2021
@yassinrais
Copy link
Author

yassinrais commented Apr 24, 2021

Oh , my bad it was

PRIMARY KEY

Instead of only

PRIMARY

@yassinrais
Copy link
Author

But the migration generator , does not put any option of indexing key
he just let it empty like

 'indexes' => [
      new Index('pk_company_id_0', ['id'], ''),
      new Index('unq_company_country_id', ['country_id', 'name'] ,'')
  ],

@BeMySlaveDarlin
Copy link
Contributor

I will check it soon and put a resolution.

@BeMySlaveDarlin
Copy link
Contributor

BeMySlaveDarlin commented May 5, 2021

First of all, pgsql adapter was hard locked for index definition creation. Using pg you should not have 'indexes' block. But you got that definition array just because your adapter in config file was Pascal case, so adapter check failed and indexes block was generated.

Made adapter check case insensitive and fixed indexes type definition.

Another point - in 'indexes' definition you cant have Primary index. That index is defined via Column definition by using option 'primary' => true.

@Jeckerson Jeckerson added this to the 2.1.x milestone May 22, 2021
@Jeckerson Jeckerson linked a pull request May 22, 2021 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PostgreSQL
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants