What is ORM Migration?
Turkish: ORM Migrasyonu
ORM migration is the practice of managing database schema changes through code files using ORM tools like Prisma or Drizzle.
What Is ORM Migration?
ORM migration is the practice of defining database schema changes in code and applying them through versioned migration files. Adding columns, creating tables, defining indexes, and changing relationships are recorded as explicit steps.
A migration file often contains SQL generated by the ORM tool. The developer changes the schema model, the tool calculates the difference, a migration file is created, and that file is run across development, staging, and production environments in order.
Typical Process
- A model or schema file is changed.
- The ORM tool generates a migration, or the developer writes one manually.
- The resulting SQL is reviewed for data-loss risk.
- The migration is tested against a test database.
- It is applied to production during deployment.
Prisma Migrate, Drizzle Kit, TypeORM migrations, Django migrations, and Rails Active Record migrations are examples in different ecosystems.
Business Use
ORM migration makes database changes part of the deployment process. Instead of asking who manually added a production column, teams can inspect the git history and the database migration table.
Risk areas include destructive migrations, locks on large tables, missing rollback plans, and deploying application code that is incompatible with the current schema. Within a broader migration plan, ORM migration files should be paired with backup and recovery strategy.
Related Terms
Database migration changes schema or data structures in versioned steps so the database stays aligned with application code.
Database MigrationDatabase migration applies table, column, index, and data transformation changes through versioned files in a controlled way.
ORM (Object-Relational Mapping)ORM maps database tables as objects, allowing database operations without writing raw SQL through library abstractions.