Repository navigation
Align DB schema with TypeORM entities - #203
Merged
Merged
Conversation
teacher_reported_today view column order and attendance_cleanup_rules lesson_id/klass_id nullability + active column type, so migration:generate reports no drift. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Po2GocBhFneXD2k9z1f6Ld
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Migration correctly applies and reverses documented schema alignment.
Review effort: Balanced
Findings: None
What changed in this PR
Adds migration aligning MySQL schema and TypeORM metadata.
Changes:
- Makes cleanup-rule keys nullable and normalizes boolean type.
- Reorders view columns and syncs metadata.
| File | Description |
|---|---|
server/src/migrations/1791306682943-AlignSchemaWithEntities.ts |
Aligns table and view schemas with entities. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This was referenced Oct 6, 2026
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
typeorm migration:generateonmainreported drift between the entities and the schema the migrations build. This PR adds one migration,AlignSchemaWithEntities1791306682943, generated by TypeORM (with the hardcoded DB name swapped fordbName, like other migrations):teacher_reported_todayview — the migration-created view listslessonReferenceIdbeforeklassReferenceId. The entity's generated SQL has the opposite order. No change to the data, only the stored SQL text.attendance_cleanup_rules—lesson_idandklass_idareNOT NULLin the DB butnullable: truein the entity.activeistinyint DEFAULT '1'vs entitytinyint(1) DEFAULT 1.No entity or app code changes.
Testing
Local MySQL 8 loaded from
db/data.sqlplus all migrations:typeorm:run→typeorm:revert→typeorm:runall succeed.migration:generate --dryrunproduces no queries (zero drift).🤖 Generated with Claude Code
https://claude.ai/code/session_01Po2GocBhFneXD2k9z1f6Ld
Generated by Claude Code