Create Hasura database migrations for EduHub. Use when adding tables, columns, constraints, or any database schema changes. Also use after schema changes to ensure migrations are created.
Use this skill when:
GNU/Linux:
date +%s%3N
macOS/BSD (alternative):
python3 -c "import time; print(int(time.time() * 1000))"
Note: The date +%s%3N command works on GNU/Linux systems but not on macOS/BSD due to differences in the date command. macOS users should use the Python one-liner instead.
Example output: 1753957404053
Create the migration folder with the timestamp:
mkdir -p backend/migrations/default/{timestamp}_{action}_{description}
Replace:
{timestamp} with the generated timestamp{action} with the action type (e.g., add_column, remove_column, create_table){description} with a snake_case description (e.g., scheduled_at_to_mail_log)Create up.sql with the schema changes:
ALTER TABLE "public"."TableName" ADD COLUMN "columnName" text;
ALTER TABLE "public"."TableName" DROP COLUMN "columnName";
CREATE TABLE "public"."TableName" (
"id" serial NOT NULL,
"name" text NOT NULL,
"created_at" timestamptz NOT NULL DEFAULT now(),
"updated_at" timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY ("id")
);
COMMENT ON TABLE "public"."TableName" IS 'Brief description of the table purpose';
Note: Always include a COMMENT ON TABLE statement to document the table's purpose. This helps maintain database documentation and makes the schema more understandable for future developers.
Create down.sql to reverse the changes:
ALTER TABLE "public"."TableName" DROP COLUMN "columnName";
ALTER TABLE "public"."TableName" ADD COLUMN "columnName" text;
DROP TABLE "public"."TableName";
For new tables or relationships, create/update metadata files in:
backend/metadata/databases/default/tables/
See the database-table-creation.md rule for metadata templates.
After ANY schema change that affects GraphQL, regenerate types using the regenerate-types skill.
Note: Hasura must be running at http://localhost:8080/v1/graphql for this to work. See the regenerate-types skill for the complete command and troubleshooting steps.
UserProfile, CourseEnrollment)firstName, organizationId)created_at, updated_at){tableName}Id (userId, courseId){timestamp}_{action}_{description} (1753957404053_add_column_status_to_mail_log)Before considering a schema-change task complete:
up.sql created with correct SQLdown.sql created to reverse changesSearch for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer