database-migration
यह क्या करती है
यह टूल आपके डेटाबेस की संरचना और डेटा को सुरक्षित तरीके से अपडेट करने में मदद करता है। इससे आप कॉलम जोड़ने या हटाने जैसे बदलाव कर सकते हैं, और अपडेट के दौरान सिस्टम चलता रहता है।
कब इस्तेमाल करें
- ✓जब आपको डेटाबेस में डेटा को व्यवस्थित करने का तरीका बदलना हो।
- ✓जब आपको अपने डेटाबेस को किसी नई तकनीक पर ले जाना हो।
- ✓सिस्टम का इस्तेमाल रोके बिना डेटाबेस अपडेट करने के लिए।
Skill का लिंक
https://github.com/wshobson/agents/blob/main/plugins/framework-migration/skills/database-migration/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मैं अपनी 'users' टेबल में नया 'email' कॉलम कैसे जोड़ूँ और यह सुनिश्चित करूँ कि वह खाली न हो?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
आप हर वांछित बदलाव के लिए विस्तृत निर्देश लिखते हैं। टूल इन निर्देशों को एक-एक करके लागू करता है, और अगर कुछ गलत हो जाए तो सब कुछ वापस पिछली स्थिति में ला सकता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Database Migration
Master database schema and data migrations across ORMs (Sequelize, TypeORM, Prisma), including rollback strategies and zero-downtime deployments.
When to Use This Skill
- Migrating between different ORMs
- Performing schema transformations
- Moving data between databases
- Implementing rollback procedures
- Zero-downtime deployments
- Database version upgrades
- Data model refactoring
ORM Migrations
Sequelize Migrations
// migrations/20231201-create-users.js
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable("users", {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true,
},
email: {
type: Sequelize.STRING,
unique: true,
allowNull: false,
},
createdAt: Sequelize.DATE,
updatedAt: Sequelize.DATE,
});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.dropTable("users");
},
};
// Run: npx sequelize-cli db:migrate
// Rollback: npx sequelize-cli db:migrate:undo
TypeORM Migrations
// migrations/1701234567-CreateUsers.ts
import { MigrationInterface, QueryRunner, Table } from "typeorm";
export class CreateUsers1701234567 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: "users",
columns: [
{
name: "id",
type: "int",
isPrimary: true,
isGenerated: true,
generationStrategy: "increment",
},
{
name: "email",
type: "varchar",
isUnique: true,
},
{
name: "created_at",
type: "timestamp",
default: "CURRENT_TIMESTAMP",
},
],
}),
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropTable("users");
}
}
// Run: npm run typeorm migration:run
// Rollback: npm run typeorm migration:revert
Prisma Migrations
// schema.prisma
model User {
id Int @id @default(autoincrement())
email String @unique
createdAt DateTime @default(now())
}
// Generate migration: npx prisma migrate dev --name create_users
// Apply: npx prisma migrate deploy
Schema Transformations
Adding Columns with Defaults
// Safe migration: add column with default
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn("users", "status", {
type: Sequelize.STRING,
defaultValue: "active",
allowNull: false,
});
},
down: async (queryInterface) => {
await queryInterface.removeColumn("users", "status");
},
};
Renaming Columns (Zero Downtime)
// Step 1: Add new column
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn("users", "full_name", {
type: Sequelize.STRING,
});
// Copy data from old column
await queryInterface.sequelize.query("UPDATE users SET full_name = name");
},
down: async (queryInterface) => {
await queryInterface.removeColumn("users", "full_name");
},
};
// Step 2: Update application to use new column
// Step 3: Remove old column
module.exports = {
up: async (queryInterface) => {
await queryInterface.removeColumn("users", "name");
},
down: async (queryInterface, Sequelize) => {
await queryInterface.addColumn("users", "name", {
type: Sequelize.STRING,
});
},
};
Changing Column Types
module.exports = {
up: async (queryInterface, Sequelize) => {
// For large tables, use multi-step approach
// 1. Add new column
await queryInterface.addColumn("users", "age_new", {
type: Sequelize.INTEGER,
});
// 2. Copy and transform data
await queryInterface.sequelize.query(`
UPDATE users
SET age_new = CAST(age AS INTEGER)
WHERE age IS NOT NULL
`);
// 3. Drop old column
await queryInterface.removeColumn("users", "age");
// 4. Rename new column
await queryInterface.renameColumn("users", "age_new", "age");
},
down: async (queryInterface, Sequelize) => {
await queryInterface.changeColumn("users", "age", {
type: Sequelize.STRING,
});
},
};
Data Transformations
…
अक्सर पूछे जाने वाले सवाल
ORM क्या है?
ORM का मतलब है 'Object-Relational Mapping'। यह एक तकनीक है जो आपके प्रोग्रामिंग कोड को डेटाबेस से जोड़ती है, और कोड के objects को डेटाबेस टेबल में और उल्टा बदलती है।
'zero-downtime' का क्या मतलब है?
'zero-downtime' का मतलब है कि डेटाबेस अपडेट के दौरान भी सिस्टम चालू रहता है और यूज़र्स के लिए उपलब्ध रहता है।
'rollback' क्या है?
Rollback का मतलब है डेटाबेस में किए गए बदलावों को पलटना, ताकि अपडेट के दौरान कुछ गलत होने पर वह पिछली स्थिति में वापस आ जाए।
जानकारी
लेखक का मूल विवरण
Execute database migrations across ORMs and platforms with zero-downtime strategies, data transformation, and rollback procedures. Use when migrating databases, changing schemas, performing data transformations, or implementing zero-downtime deployment strategies.
repo: wshobson/agents
लोकप्रियता
- GitHub स्टार
- 41k
- रैंकिंग में स्थान
- #6696
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
screen-reader-testing
41kआपके एजेंट को screen readers का इस्तेमाल करके वेबसाइटों की जांच करने देता है, ताकि यह पक्का हो सके कि वे accessible हैं।
wcag-audit-patterns
41kआपके एजेंट को वेबसाइटों का accessibility audit करने और WCAG guidelines के हिसाब से समस्याएं ठीक करने में मदद करता है।
multi-reviewer-patterns
41kआपके एजेंट को कई code reviews को एक साथ चलाने देता है। यह एक जैसे findings हटाता है और सारी रिपोर्ट को एक जगह जोड़ता है।
parallel-debugging
41kआपके एजेंट को parallel जांच के साथ जटिल समस्याओं को debug करने और root cause analysis में मदद करता है।
मिलती-जुलती skills
api-connector-builder
280kयह आपके एजेंट को मौजूदा pattern के हिसाब से नए API connections बनाने देता है। जब बिना कोई नया तरीका बनाए एक और integration जोड़ना हो, तब इसका इस्तेमाल करें।
api-design
280kयह आपके एजेंट को best practices के हिसाब से REST APIs डिज़ाइन करने में मदद करता है। यह तय करने में काम आता है कि APIs आपस में कैसे बात करें, errors कैसे दिखें, और data को कैसे व्यवस्थित करें।
backend-patterns
280kआपके एजेंट को server-side architecture patterns और database optimization में मदद करता है। server पर चलने वाला code बनाने या review करने के लिए उपयोगी है।