vapor / fluent-postgres-driver

🐘 PostgreSQL driver for Fluent.
MIT License
149 stars 53 forks source link

Support adding multiple enum cases at once #190

Closed seeppp closed 2 years ago

seeppp commented 2 years ago

Fixes an issue where updating a table to add multiple new enum cases would only add the last case to the database.

Fixes #189

0xTim commented 2 years ago

@seeppp Thanks for the PR! Could you add a test case to cover the bug fix? Thanks!

seeppp commented 2 years ago

@0xTim I added a test case, it does the following:

  1. Prepares an enum type and a model using that enum
  2. Saves a model using that model.
  3. Adds a migration which adds two new cases to the database
  4. Tests if both cases could be updated to the model

Almost all other tests are in the FluentKit Benchmarker and there is actually a PR which tests the same case: https://github.com/vapor/fluent-kit/pull/416. If merging both, this and that PR, multiple enum cases are tested twice for PostgreSQL.

0xTim commented 2 years ago

Original comment:

Fixes #189

This PR allows to update an enum table with multiple cases. In previous versions, only the last case was added to the database.

This fix is similar to #178, which does the same thing but isn't updated for over a year now.

To test the change, https://github.com/vapor/fluent-kit/pull/416 could be merged as well. In the current version there is no test case to alter an enum table with multiple cases.

VaporBot commented 2 years ago

These changes are now available in 2.2.4