| name | create-migration |
| description | Create and review EduHub Hasura schema migrations. Use when adding tables, columns, constraints, relationships, or other database schema changes, and when coordinating the required metadata, query, type-generation, and function follow-up steps. |
Create Migration
Use this skill for any EduHub schema change.
Required Workflow
Do not consider a schema-change task complete until all relevant steps are done:
- Create the SQL migration directory in
backend/migrations/default/
- Add both
up.sql and down.sql
- Update Hasura metadata if tables, relationships, or permissions changed
- Update GraphQL queries or fragments affected by the schema change
- Regenerate GraphQL types
- Scan
functions/ for affected table or column usage and update function logic if needed
Migration Folder Naming
Use:
backend/migrations/default/{timestamp}_{action}_{description}/
Examples:
backend/migrations/default/1753957404053_add_column_status_to_mail_log/
backend/migrations/default/1753957404053_create_table_AttendanceAudit/
SQL Expectations
up.sql should do the real change
down.sql should reverse it cleanly
- new tables should include a table comment where practical
- keep the SQL narrow and explicit; do not mix unrelated schema changes in one migration
Metadata And Query Follow-Up
After schema changes:
- update
backend/metadata/ when permissions, tables, or relationships changed
- update queries in
frontend-nx/apps/edu-hub/queries/ if field shape changed
- use the
regenerate-types skill for codegen
Function Impact Scan
This repo has serverless consumers under functions/.
For every changed table or column:
- search
functions/ for the old and new names
- update GraphQL queries or business logic where needed
- pay special attention to
functions/callNodeFunction/, functions/sendMail/, and related modules
Suggested search:
rg "<table_or_column_name>" functions/
Naming Conventions
- tables: PascalCase
- columns: camelCase
- timestamp fields: usually
created_at, updated_at
- foreign keys:
{tableName}Id
Output Style For This Skill
When asked to make a schema change, carry the work through this checklist and
state clearly which of the six required follow-up steps were completed.