create-migration

Generate Supabase PostgreSQL migrations with RLS policies, indexes, triggers, and grants.

Updated May 27, 2026
One-click install
npx skills add https://github.com/Rkaaaa404/cyberhack-SYDT --skill create-migration-rkaaaa404
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: create-migration
Source: https://github.com/Rkaaaa404/cyberhack-SYDT/tree/main/.agents/skills/create-migration
Command: npx skills add https://github.com/Rkaaaa404/cyberhack-SYDT --skill create-migration-rkaaaa404

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing database migrations by hand is error-prone: developers often forget Row Level Security policies, indexes on foreign keys, audit columns, or proper grants, leading to insecure or slow schemas. This Skill standardizes Supabase PostgreSQL migration generation so every table follows consistent naming, security, and audit conventions. ## Core Features & Use Cases - Complete Migration Scaffolding: Produces migration files with header comments, CREATE TABLE statements, RLS enablement and policies, indexes, triggers, and GRANT statements in the correct supabase/migrations/[timestamp]_[description].sql location. - DaaS Naming & Audit Conventions: Enforces snake_case plural tables, UUID primary keys, and standard audit columns (date_created, date_updated, user_created, user_updated). - Relationship & Policy Patterns: Provides ready-made templates for one-to-many foreign keys, many-to-many junction tables, and common RLS policies such as owner-only CRUD and public-read for published content. - Use Case: When adding a new blog_posts collection to a Supabase project, invoke this Skill to get a full migration including RLS policies, indexes on foreign keys, and an auto-updating date_updated trigger, then apply it with supabase db push. ## Quick Start Ask the AI to create a database migration for a new table, for example: "Create a migration for a products table with name, price, and a category foreign key."

Frequently Asked Questions about create-migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Supabase database migration with RLS policies?▼

Create a timestamped SQL file in supabase/migrations containing CREATE TABLE, ALTER TABLE ... ENABLE ROW LEVEL SECURITY, and CREATE POLICY statements for SELECT, INSERT, UPDATE, and DELETE. Apply it with the supabase db push command.

What naming conventions should PostgreSQL tables and columns follow?▼

Tables use snake_case plural names like user_profiles, columns use snake_case like date_created, primary keys are UUID columns named id, and foreign keys follow the pattern [referenced_table]_id such as category_id.

How do I create a many-to-many relationship in PostgreSQL?▼

Create a junction table named [table1]_[table2] with two foreign key columns referencing both tables, each with ON DELETE CASCADE, plus a UNIQUE constraint on the column pair to prevent duplicate associations.

Which PostgreSQL data type should I use for JSON or timestamps?▼

Use jsonb for JSON data and timestamptz for timestamps. UUIDs use the uuid type, decimals use numeric with precision and scale, and enums are typically text columns with CHECK constraints.

How do I restrict table access so users only see their own rows?▼

Enable row level security on the table and create a policy such as FOR ALL USING (auth.uid() = user_created). This ensures each authenticated user can only access rows they created.