Schema Definition and Migrations

How each ORM defines the database schema and evolves it over time.

Active Record (Ruby on Rails)

Schema evolves through Ruby-based migration files (db/migrate), with the current schema also reflected in an auto-generated schema.rb snapshot.

Eloquent (Laravel)

Schema evolves through PHP migration files using Laravel’s fluent schema builder, run via the artisan migrate command.

Django ORM

Schema is derived from Python model classes, with Django auto-generating migration files (makemigrations) by diffing models against the previous migration state.

Prisma

Schema-first: you write a .prisma schema file describing your models, and Prisma generates SQL migrations from it (prisma migrate) plus a fully typed client to match.

Drizzle

Code-first, defined directly in TypeScript; Drizzle Kit can generate SQL migration files from your schema definitions or push schema changes directly during development.

TypeORM

Code-first, defined through decorated TypeScript entity classes; migrations can be auto-generated by diffing entities against the database or written by hand.

Sequelize

Code-first, defined through JavaScript model definitions, with migrations written as separate files using Sequelize’s CLI and migration API.

SQLAlchemy

Code-first, defined through Python classes (or Core table objects); schema migrations are typically handled by the companion tool Alembic rather than SQLAlchemy itself.

Entity Framework Core

Code-first (the common approach) or database-first (scaffolding models from an existing database), with migrations generated and applied through the dotnet ef CLI tooling.

Hibernate (JPA)

Code-first through annotated Java classes; schema generation/validation is built in, but production migrations are typically managed by a separate tool like Flyway or Liquibase.

GORM

Code-first through Go structs, with a lightweight AutoMigrate feature for simple schema changes, though most production setups pair GORM with a dedicated migration tool for anything complex.

Diesel

Schema is defined in SQL migration files first, and Diesel’s CLI generates a matching, compile-time-checked Rust schema representation from the database — the reverse direction from most code-first ORMs.