Skip to content
This repository has been archived by the owner on Aug 5, 2019. It is now read-only.

Don't add CREATE SCHEMA public commands to down migrations #551

Merged
merged 7 commits into from
May 29, 2019

Conversation

gregtyler
Copy link
Contributor

@gregtyler gregtyler commented May 28, 2019

Purpose

Down migrations generated by Doctrine include a CREATE SCHEMA public command. This is erroneous and causes the down migrations to fail (because the public schema already exists).

This is a known issue in Doctrine DBAL.

Approach

I removed the CREATE SCHEMA public command from existing migrations, and also introduced a listener which stops them from being added unless necessary (e.g. if we start using multiple schemas).

Learning

I took the fix from a comment on the GitHub issue. This seems to be the accepted solution for now, awaiting Doctrine to fix the issue permanently.

Checklist

  • I have performed a self-review of my own code
  • [N/A] I have updated documentation (Confluence/GitHub wiki) where relevant
  • [N/A] I have added tests to prove my work, and they follow our best practices
  • [N/A] I have successfully built my branch to a feature environment
  • New and existing unit tests pass locally with my changes (docker-compose run --rm api sh scripts/apiunittest.sh)
  • There are no Composer security issues (docker-compose run api php app/console security:check)
  • [N/A] The product team have tested these changes

@gregtyler gregtyler marked this pull request as ready for review May 28, 2019 14:30
@gregtyler gregtyler requested a review from alexeves May 28, 2019 14:30
@gregtyler gregtyler mentioned this pull request May 28, 2019
2 tasks
gregtyler added 5 commits May 29, 2019 09:17
You don't need to remove `CREATE SCHEMA public` commands now because this PR does it for you
Deleting `var/cache` itself causes a permissions mishap. Instead, delete the contents of that directory like every other script does.
@gregtyler gregtyler merged commit b54b490 into master May 29, 2019
@gregtyler gregtyler deleted the support-no-create-public-schema branch May 29, 2019 09:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants