-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Current situation
Currently, in devconf (core/scripts/init.sh) and in the test scripts, the database is created using doctrine:schema:create.

Also, there are migrations.
The problem is that the schema created by doctrine:schema:create, changes over time, but the migrations assume a steady base.
So currently, they are not compatible with each other.
When you first run doctrine:schema:create, and then run the migrations, the following error occurs:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'eb_test.sso_provider_roles' doesn't exist
What this means is:
- In development/pipeline, the tests are not executed on the same database schema as used in production
- Development is not done on the same schema as used in production.
- When a developer creates a migration, it is probably based on a schema that is currently not in production!
Proposed solution:
Never use doctrine:schema:create, always execute the migrations.
Changes needed
Ensure the doctrine:migrations:migrate command can be executed on an empty database.
This can be done by:
- Adding a migration at the beginning of the migration that sets the base state.
- OR
- Squash current migrations: Take the current production database schema (ensure all migrations are executed, including
Version20230824090020), delete all old migrations, and create a new migration that creates the schema based on that export.
In both scenario's, the migration should not be executed on production environments, and be set to executed manually.
Related
This is not applied on production? #1262
Metadata
Metadata
Assignees
Labels
Type
Projects
Status