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

chore: add initial seeder #452

Conversation

tomudding
Copy link
Member

Description

The data fixtures can be loaded into the database using the application:fixtures:load command. All existing records are TRUNCATEd from the database to ensure a clean start.


Unfortunately, adding the data fixtures for (sub)decisions has proved to be quite difficult. As such, these have been removed. The WIP can be found in GEWIS/gewisweb#1913.

There is an issue with the "hydration" of the entities when they are added to the database. I have not seen this issue in GEWISDB, but the cause appears to be the usage of BackedEnums as part of a composite key (which forms the foundation for our (sub)decision entities and relations).

Either the enum cannot be cast to string while being saved to the database. Or when using custom mapping types (see the PR mentioned) above the value cannot be properly restored from the database. The latter can then also be fixed with another patch for ORM (see GEWIS/orm@8031547), however, this may break other things. This patch can probably also be applied in reverse, such that we do not need the custom mapping types. However, this has not (yet) been tested.

As such, this has to be investigated more and potentially a bug report must be submitted to Doctrine ORM to get this fixed.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation improvement (no changes to code)
  • Other (please specify)

With data fixtures we can do actual seeding of the test database.
@tomudding tomudding changed the title Chore/initial data fixtures for seeding the database chore: add initial seeder Nov 20, 2024
The data fixtures can be loaded into the database using the
`application:fixtures:load` command. All existing records are `TRUNCATE`d from
the database to ensure a clean start.

---

Unfortunately, adding the data fixtures for (sub)decisions has proved to be
quite difficult. As such, these have been removed. The WIP can be found in
GEWIS/gewisweb#1913.

There is an issue with the "hydration" of the entities when they are added to
the database. I have not seen this issue in GEWISDB, but the cause appears to be
the usage of `BackedEnum`s as part of a composite key (which forms the
foundation for our (sub)decision entities and relations).

Either the enum cannot be cast to string while being saved to the database. Or
when using custom mapping types (see the PR mentioned) above the value cannot
be properly restored from the database. The latter can then also be fixed with
another patch for ORM (see GEWIS/orm@8031547),
however, this may break other things. This patch can probably also be applied in
reverse, such that we do not need the custom mapping types. However, this has
not (yet) been tested.

As such, this has to be investigated more and potentially a bug report must be
submitted to Doctrine ORM to get this fixed.
@tomudding tomudding force-pushed the chore/initial-data-fixtures-for-seeding-the-database branch from 7dca1e3 to 1298cd8 Compare November 20, 2024 15:31
@tomudding tomudding merged commit 234af59 into GEWIS:main Nov 20, 2024
4 checks passed
github-actions bot added a commit that referenced this pull request Nov 20, 2024
Tom Udding: Merge pull request #452 from tomudding/chore/initial-data-fixtures-for-seeding-the-database

chore: add initial seeder

Co-authored-by: tomudding <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant