Skip to content

Commit 3d184cd

Browse files
Anty0dkrizan
andauthored
chore: add migration check job to CI workflow + fix missaligned db migration (#3476)
## Summary - Adds a new `migration-check` CI job that runs `./gradlew diffChangeLog` and fails if migration files are out of date - Reuses the backend build artifact (same as `schema-check` and `backend-test`) - Wired into `everything-passed` gate so PRs with stale migrations cannot merge <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * CI pipeline now includes an automated migration check that validates database migration files are up-to-date before completing builds. * **Refactor** * Database indexing was adjusted to change how certain activity records are indexed, improving query behavior and performance in relevant lookups. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Daniel Krizan <danyelkrizan@gmail.com>
1 parent ce0eb6d commit 3d184cd

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,40 @@ jobs:
322322
fi
323323
echo "✅ Schema files are up to date"
324324
325+
migration-check:
326+
name: Migration Check 🗃️
327+
needs: [backend-build]
328+
runs-on: ubuntu-24.04
329+
steps:
330+
- uses: actions/checkout@v4
331+
332+
- name: Setup environment
333+
uses: ./.github/actions/setup-env
334+
with:
335+
node: "false"
336+
337+
- name: Download backend build result
338+
uses: ./.github/actions/download-backend-build
339+
340+
- name: Generate migration diff
341+
run: ./gradlew diffChangeLog
342+
env:
343+
SKIP_SERVER_BUILD: true
344+
345+
- name: Check for uncommitted migration changes
346+
run: |
347+
if [ -n "$(git status --porcelain)" ]; then
348+
echo "❌ Migration files are out of date! Please run './gradlew diffChangeLog' locally and commit the changes."
349+
echo ""
350+
echo "Changed files:"
351+
git status --porcelain
352+
echo ""
353+
echo "Diff:"
354+
git diff
355+
exit 1
356+
fi
357+
echo "✅ Migration files are up to date"
358+
325359
e2e-code-checks:
326360
name: E2E Static Check 🪲
327361
runs-on: ubuntu-24.04
@@ -399,6 +433,7 @@ jobs:
399433
- frontend-build
400434
- frontend-code-check
401435
- schema-check
436+
- migration-check
402437
- e2e
403438
- e2e-code-checks
404439
- e2e-install-deps
@@ -433,6 +468,10 @@ jobs:
433468
failed_jobs+=("schema-check")
434469
fi
435470
471+
if [[ "${{ needs.migration-check.result }}" != "success" ]]; then
472+
failed_jobs+=("migration-check")
473+
fi
474+
436475
if [[ "${{ needs.e2e.result }}" != "success" ]]; then
437476
failed_jobs+=("e2e")
438477
fi

backend/data/src/main/kotlin/io/tolgee/model/activity/ActivityModifiedEntity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import java.io.Serializable
2121
@Entity
2222
@Table(
2323
indexes = [
24-
Index(columnList = "branch_id"),
24+
Index(columnList = "activity_revision_id,branch_id"),
2525
],
2626
)
2727
@IdClass(ActivityModifiedEntityId::class)

0 commit comments

Comments
 (0)