fix: Allow multiple accounts per (party, org, instrument) - unblock n… #971
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Schema Validation | |
| on: | |
| push: | |
| branches: [develop, main] | |
| paths: | |
| - 'services/*/migrations/**' | |
| - 'services/*/adapters/persistence/*_entity.go' | |
| - 'shared/domain/models/**' | |
| - 'utilities/atlas-loader/**' | |
| - 'services/*/atlas/**' | |
| pull_request: | |
| branches: [develop, main] | |
| paths: | |
| - 'services/*/migrations/**' | |
| - 'services/*/adapters/persistence/*_entity.go' | |
| - 'shared/domain/models/**' | |
| - 'utilities/atlas-loader/**' | |
| - 'services/*/atlas/**' | |
| permissions: | |
| contents: read | |
| jobs: | |
| validate-schema: | |
| name: Validate Migrations Match Entities | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.26.2' | |
| cache: true | |
| - name: Install protoc | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y protobuf-compiler | |
| - name: Install Go proto tools | |
| run: | | |
| go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | |
| go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest | |
| go install github.com/bufbuild/buf/cmd/buf@latest | |
| - name: Generate protobuf code | |
| run: make proto | |
| - name: Run schema validation tests | |
| run: | | |
| echo "Running schema validation tests..." | |
| echo "This test validates that SQL migrations produce a schema compatible with GORM entities." | |
| echo "" | |
| go test -v -run TestMigrationsMatchEntities ./shared/platform/testdb/ | |
| timeout-minutes: 10 | |
| - name: Report schema mismatches | |
| if: failure() | |
| run: | | |
| echo "::error::Schema validation failed. This means there is a mismatch between:" | |
| echo "::error:: - SQL migrations in services/*/migrations/*.sql" | |
| echo "::error:: - GORM entities in services/*/adapters/persistence/*_entity.go" | |
| echo "::error::" | |
| echo "::error::Common causes:" | |
| echo "::error:: 1. Entity column names don't match migration column names" | |
| echo "::error:: 2. Entity field types don't match migration column types" | |
| echo "::error:: 3. Missing columns in migrations that entities expect" | |
| echo "::error:: 4. Check constraints that entity values violate" | |
| echo "::error::" | |
| echo "::error::To fix:" | |
| echo "::error:: - Review the test output above for specific errors" | |
| echo "::error:: - Either update the entity to match the migration schema" | |
| echo "::error:: - Or create a new migration to add missing columns" | |
| exit 1 |