doctrine / dbal

Doctrine Database Abstraction Layer
https://www.doctrine-project.org/projects/dbal.html
MIT License
9.43k stars 1.33k forks source link

postgresql schema diff generate DROP INDEX statement without schema_name #2535

Open josensanchez opened 7 years ago

josensanchez commented 7 years ago

example:

/**
 * class Foo definition
 *
 * @ORM\Table(name="foo", schema="a_schema_name")
 */
class Foo {

    /**
     * @ManyToOne(targetEntity="Address")
     * @JoinColumn(name="address_id", referencedColumnName="id")
     */
    private $address;
...

let say now the address must be unique so we add the unique=true notation

@JoinColumn(name="address_id", referencedColumnName="id", unique=true)

the schema diff generate shomething like:

DROP INDEX idx_8f16808653af4e34;
CREATE UNIQUE INDEX UNIQ_8F16808653AF4E34 ON a_schema_name.foo (address_id)

if we run this sql it throws

_ERROR: index "idx8f16808653af4e34" does not exist SQL state: 42704

instead, including the schema name to the sentence:

DROP INDEX a_schema_name.idx_8f16808653af4e34;

shows

Query returned successfully with no result in 29 msec.

tested on postgresql 9.5

photodude commented 7 years ago

Something like this seems to be showing up in the Travis CI tests now that postgresql 9.5 is included in the tests. https://travis-ci.org/doctrine/dbal/jobs/173659068

diwaly commented 7 years ago

I have the same issue. It missing the schema name on drop index.

Julian-Louis commented 8 months ago

Hello, were you able to find any solutions?