immigrant
Declare your schema. Get migrations for free.
Stop writing SQL migrations by hand. Describe your database in a single file, and immigrant figures out what changed and how to migrate.
Define your schema
scalar user_id = sql"INTEGER";
enum role {
admin;
member;
};
table User {
user_id @primary_key;
role;
name: sql"TEXT";
};
Get SQL migrations
CREATE TYPE role
AS ENUM ('admin', 'member');
CREATE DOMAIN user_id
AS INTEGER;
CREATE TABLE "user" (
user_id user_id PRIMARY KEY,
role role NOT NULL,
name TEXT NOT NULL
);
Declarative
Describe what your database should look like, not how to get there. Immigrant computes the diff and generates migrations automatically.
Type-safe
Scalars, enums, structs, and foreign keys are first-class. Reuse types across tables — immigrant resolves them by name.
PostgreSQL-native
Generates proper domains, composite types, naming conventions, and COMMENT ON statements. Not a lowest-common-denominator abstraction.