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

Join table name are wrong when a platform can emulate schemas #5784

Closed
qpautrat opened this issue Apr 15, 2016 · 3 comments
Closed

Join table name are wrong when a platform can emulate schemas #5784

qpautrat opened this issue Apr 15, 2016 · 3 comments
Assignees
Labels
Milestone

Comments

@qpautrat
Copy link

Hello everyone,

Considering this schema:

Product:
  type: entity
  table: products
  schema: test
  id:
    id:
      type: integer
      generator:
        strategy: AUTO
  fields:
    name:
      type: string
  manyToMany:
        options:
            targetEntity: Option
            joinTable:
                name: product_option
                schema: test
                joinColumns:
                  product_id:
                    referencedColumnName: id
                inverseJoinColumns:
                  option_id:
                    referencedColumnName: id

Option:
  type: entity
  table: options
  schema: test
  id:
    id:
      type: integer
      generator:
        strategy: AUTO
  fields:
    label:
      type: string

Create command orm:schema-tool:drop --dump-sql is giving me following sql statements:

CREATE TABLE test__options (id INTEGER NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id));
CREATE TABLE test__products (id INTEGER NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id));
CREATE TABLE test__product_option (product_id INTEGER NOT NULL, option_id INTEGER NOT NULL, PRIMARY KEY(product_id, option_id), CONSTRAINT FK_F811B85D4584665A FOREIGN KEY (product_id) REFERENCES test__products (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_F811B85DA7C41D6F FOREIGN KEY (option_id) REFERENCES test__options (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
CREATE INDEX IDX_F811B85D4584665A ON test__product_option (product_id);
CREATE INDEX IDX_F811B85DA7C41D6F ON test__product_option (option_id);

But when I want to drop my schema, many to many relation table is missing in sql statements:
orm:schema-tool:drop --dump-sql

DROP TABLE test__options;
DROP TABLE test__products

This is happening because DefaultQuoteStrategy::getJoinTableName() does not care about platform which can emulate schema unlike getTableName().

@ptkoz
Copy link

ptkoz commented Nov 23, 2019

Any chance to get that solved? The PR is up for over 3 years now. Happy to help bringing it over the line.

@greg0ire
Copy link
Member

@pamelus I commented on the PR. If you see on activity, you can address my comments yourself.

@lcobucci
Copy link
Member

Can you check if this happens in 2.7.0? #7079 should have solved this.

@lcobucci lcobucci modified the milestones: 2.8.0, 2.7.0 Nov 25, 2019
@lcobucci lcobucci self-assigned this Nov 25, 2019
@lcobucci lcobucci added the Bug label Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants