phalcon/migrations

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

yassinrais opened this issue · 4 comments

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

Oh , my bad it was

PRIMARY KEY

Instead of only

PRIMARY

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'] ,'')
  ],

I will check it soon and put a resolution.

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.