database-migration
إنشاء ترحيلات قاعدة بيانات Supabase
Également disponible depuis: Doyajin174,wshobson
تغييرات مخطط قاعدة البيانات عرضة للأخطاء ويمكن أن تعطل الإنتاج. توفر هذه المهارة أنماطًا مجربة لإنشاء ترحيلات Supabase متكررة مع عزل مساحة العمل وسياسات أمان على مستوى الصف.
Télécharger le ZIP du skill
Importer dans Claude
Allez dans Paramètres → Capacités → Skills → Importer un skill
Activez et commencez à utiliser
Tester
Utilisation de "database-migration". Create a migration for a 'project_tasks' table with name, status, due_date, and workspace_id. Include workspace isolation and RLS.
Résultat attendu:
- تم إنشاء الجدول مع workspace_id والمراجع المناسبة
- تمت إضافة فهرس على workspace_id لأداء الاستعلام
- تم تمكين RLS مع نمط الانضمام user_organizations
- تسمح سياسة SELECT للمستخدمين بعرض مهام مساحة العمل الخاصة بهم
- تمكن سياسة النظام الإدارة عبر دور الخدمة
- الترحيل متكرر مع عبارات IF NOT EXISTS
Utilisation de "database-migration". Add an ENUM type 'order_status' with values 'pending', 'processing', 'shipped', 'delivered', 'cancelled'
Résultat attendu:
- تم إنشاء نوع ENUM باستخدام نمط كتلة DO $$
- الإنشاء المتكرر يتعامل مع النوع الموجود بسلاسة
- تمت إضافة عمود إلى جدول orders بالنوع الجديد
Utilisation de "database-migration". Create a function to calculate order total with items and tax
Résultat attendu:
- تم إنشاء الدالة مع معالجة معاملات مناسبة
- يستخدم CREATE OR REPLACE للتكرار
- يتضمن معالجة أخطاء مناسبة مع كتلة EXCEPTION
- يعيد الإجمالي المحسوب كعدد صحيح
Audit de sécurité
SûrThis is a documentation-only skill containing SQL migration patterns and guidelines. All static findings are false positives: the scanner misinterprets SQL syntax ($$ dollar quotes as backticks, gen_random_uuid as weak crypto, RLS mentions as crypto, BEGIN/END blocks as Windows SAM). No executable code, no file system access, no network calls, no command execution.
Facteurs de risque
🌐 Accès réseau (1)
📁 Accès au système de fichiers (1)
⚙️ Commandes externes (30)
Score de qualité
Ce que vous pouvez construire
إضافة جداول جديدة بأمان
إنشاء جداول مع RLS وفهارس وعزل مساحة العمل المناسبة في مشاريع Supabase
أتمتة تغيير المخطط
إنشاء أنماط ترحيل متسقة لخطوط أنابيب نشر CI/CD
تصميم قاعدة بيانات متعددة المستأجرين
تنفيذ عزل آمن متعدد المستأجرين مع فرض أمان على مستوى الصف
Essayez ces prompts
Create a migration for a new table called 'project_tasks' with name, status, due_date, and workspace_id. Include workspace isolation and RLS.
Generate migration to add an ENUM type 'task_priority' with values 'low', 'medium', 'high', 'urgent' and a column using it.
Write a migration that adds an update_updated_at trigger to the 'users' table that sets updated_at on row changes.
Create a complete migration for a 'customer_orders' module with tables, foreign keys, indexes, enums, RLS policies for admins and customers, and a function to calculate order totals.
Bonnes pratiques
- تحقق دائمًا من schema-reference.md للجداول الموجودة قبل إنشاء جداول جديدة
- استخدم IF NOT EXISTS و CREATE OR REPLACE لجعل الترحيلات قابلة لإعادة التشغيل
- أضف دائمًا workspace_id مع حذف CASCADE للجداول متعددة المستأجرين
- قم بتضمين سياسات RLS مع قواعد وصول المستخدم وإدارة النظام
Éviter
- استخدام جدول workspace_members بدلاً من نمط الانضمام user_organizations
- إنشاء ترحيلات بدون فحوصات IF NOT EXISTS المتكررة
- فقدان الفهارس على workspace_id مما يسبب مشاكل في أداء الاستعلام
- نسيان تمكين RLS أو إنشاء سياسات بعد ALTER TABLE