Skip to content

fix: add check on models and migrations to ensure migrations are included in PR#546

Open
rinkp wants to merge 4 commits into
GEWIS:mainfrom
rinkp:fix/migrations
Open

fix: add check on models and migrations to ensure migrations are included in PR#546
rinkp wants to merge 4 commits into
GEWIS:mainfrom
rinkp:fix/migrations

Conversation

@rinkp

@rinkp rinkp commented Jun 20, 2026

Copy link
Copy Markdown
Member

Description

With this PR, three migration-related issues are resolved:

  • No new empty migrations will be created
  • The open migration for the VerstionTrait of ConfigItem is resolved
  • CI will check if any migrations are missing in a PR if the models or migrations are touched

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): CI/CD

@rinkp rinkp requested a review from Copilot June 20, 2026 15:42
@rinkp rinkp force-pushed the fix/migrations branch 2 times, most recently from 407f837 to 803f31e Compare June 20, 2026 15:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent missing Doctrine migrations by (1) adjusting how migrations are generated/cleaned up locally and (2) adding a GitHub Actions workflow that regenerates migrations in CI and fails the PR if new migration files would be produced. It also updates the shared VersionTrait mapping to introduce a default value for the version column.

Changes:

  • Update VersionTrait to set a DB-level default (1000) for the optimistic-locking version column.
  • Extend make migration-diff to post-process generated migration files and delete “empty” migrations.
  • Add a new GitHub Actions workflow to detect missing migrations on pull requests that touch models/migrations.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
module/Database/src/Model/Trait/VersionTrait.php Adds a default to the Doctrine #[Column] mapping for the version field.
Makefile Adds migration post-processing (sed cleanup + deleting empty migrations) to migration-diff.
.github/workflows/ensure-migrations.yml New CI workflow to regenerate migrations and fail if changes appear under migrations/.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment thread .github/workflows/ensure-migrations.yml Outdated
Comment thread .github/workflows/ensure-migrations.yml Outdated
@rinkp rinkp changed the title Introduce check to ensure migrations are included in PR fix: add check on models and migrations to ensure migrations are included in PR Jun 20, 2026
@rinkp rinkp marked this pull request as ready for review June 20, 2026 18:54
@rinkp rinkp requested a review from tomudding June 20, 2026 18:54
@tomudding

Copy link
Copy Markdown
Member

This remark also comes from: #545 (comment). So I think we should add changes to the existing workflow to this PR as well.

Makes the check lightweight by only starting the web and Postgres containers.
Custom template for the migrations such that we can more easily test migrations
instead of relying on `sed`.

Combines the up-to-date check with the existing migration and seed workflow into
a single workflow on the same web and Postgres stack. Splits `seed` so it only
seeds the core databases (fixtures and report), as Mailman and Listmonk are
sync-based and not needed to test migrations or seeders.
@tomudding

tomudding commented Jun 26, 2026

Copy link
Copy Markdown
Member

3a7d214 solves the issue from GH-545 by running checks only on the web and postgres containers. However, since seed-core does not exist on main, it fails.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/test-migrations.yml
Comment thread config/migration.tpl
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

3 participants