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

Generalize platform SQL #4807

Merged
merged 4 commits into from
Sep 19, 2021
Merged

Conversation

morozov
Copy link
Member

@morozov morozov commented Sep 19, 2021

Q A
Type improvement
BC Break no
  1. The CREATE DATABASE and DROP DATABASE statements are identical on all platforms that support databases.
  2. The DBAL uses users on Oracle to emulate databases, so it should implement the "Create database" operation as CREATE USER. It already does the same with regards to dropping a database.
  3. The IBM DB2 platform declares that it doesn't support databases:
    public function supportsCreateDropDatabase()
    {
    return false;
    }
    but its test attempt to cover the generation of the CREATE DATABASE and DROP DATABASE statements:
    self::assertEquals('CREATE DATABASE foobar', $this->platform->getCreateDatabaseSQL('foobar'));
    self::assertEquals('DROP DATABASE foobar', $this->platform->getDropDatabaseSQL('foobar'));
  4. The CREATE SCHEMA and DROP SCHEMA statements are identical on all platforms that support schemas.
  5. The CREATE VIEW and DROP VIEW statements are identical on all platforms.
  6. The is a common implementation of DROP SEQUENCE statements for all platforms that support sequences.

@morozov
Copy link
Member Author

morozov commented Sep 19, 2021

I don't think it's worth covering the paths where the NotSupported exceptions are thrown with tests. This is a side effect of the AbstractPlatform being a god object and declaring the super-set of the APIs that its child classes implement.

The proper way to address this issue is to take the gigantic API apart.

@morozov morozov merged commit 14a0824 into doctrine:3.2.x Sep 19, 2021
@morozov morozov deleted the generalize-platform-sql branch September 19, 2021 20:38
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants