HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
bikeshedder
tusker
Rust2022–2025
bikeshedder / tusker

tusker

PostgreSQL schema diffing, migration running, and type-safe queries.

6Distinct people
10Mentions
0Explicit recommenders
18GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

PostgreSQL schema diffing, migration running, and type-safe queries.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year10 dated mentions

Observed mentions: 2022-02-26 20:00:27 UTC to 2025-04-03 22:54:39 UTC.

012342022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments20222023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20232024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2025

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC413
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC303
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC101
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC202

What Hacker News says

10 sources
There are a few stand-alone declarative Postgres tools available, including Stripe's pg-schema-diff [1], Tusker [2] which wraps Migra [3], and sqldef [4] which supports multiple DBMS. For sake of completeness for users of other databases: for SQLite check out stb-tester's migrator [5], and last but not least for MySQL/MariaDB there's my tool Skeema [6]. [1] https://github.com/stripe/pg-schema-diff [2] https://github.com/bikeshedder/tusker [3] https://github.com/djrobstep/migra [4] https://github.com/sqldef/sqldef/ [5] https://david.rothlis.net/declarative-schema-migration-for-s... [6] https://github.com/skeema/skeema
In Declarative Schemas for simpler database management
Thanks! Yeah definitely agree that building out declarative table management for Postgres would be a major effort. A few open source projects I've seen in that area include: https://github.com/sqldef/sqldef (Go) https://github.com/bikeshedder/tusker (Python but being ported to Rust) https://github.com/tyrchen/renovate (Rust) https://github.com/blainehansen/postgres_migrator (Rust) Some of these are based on parsing SQL, and others are based on running the CREATEs in a temporary location and introspecting the result. The schema export side can be especially tricky for Postgres, since it lacks a built-in equivalent to MySQL's SHOW CREATE TABLE. So most of these declarative pg tools shell out to pg_dump, or require the user to do so. But sqldef actually implements CREATE TABLE dumping in pure Golang if I recall correctly, which is pretty coo
Read the rest
l. There's also the question of implementing the table diff logic from scratch, vs shelling out to another tool or using a library. For the latter path, there's a nice blog post from Supabase about how they evaluated the various options: https://supabase.com/blog/supabase-cli#choosing-the-best-dif...
In We built our customer data warehouse all on Postgres
Big fan of tusker (https://github.com/bikeshedder/tusker) for PostgreSQL migrations. Tusker takes a SQL-first approach; You write your schema in declarative DDL (I have my entire project in one schema.sql file) and when you edit it, tusker generates the sql code required to migrate. It uses temporary test databases to run both your declarative DDL and your step-by-step migrations to ensure they are in lock step. And it can connect to live databases and diff your schema/migrations against reality. I've never seen a better toolkit for schema evolution.
In Ask HN: What are some unpopular technologies you wish people knew more about?
The best solution I've ever seen is this Rust library https://github.com/cornucopia-rs/cornucopia You write plain SQL for you schema (just a schema.sql is enough) and plain SQL functions for your queries. Then it generates Rust types and Rust functions from from that. If you don't use Rust, maybe there's a library like that for your favorite language. Optionally, pair it with https://github.com/bikeshedder/tusker or https://github.com/blainehansen/postgres_migrator (both are based off https://github.com/djrobstep/migra) to generate migrations by diffing your schema.sql files, and https://github.com/rust-db/refinery to perform those migrations. Now, if you have simple crud needs, you should probably use https://postgrest.org/en/stable/ and not an ORM. There are packages like https://www.npmjs.com/package/@supabase/postgrest-js (for JS / ty
Read the rest
pescript) and probably for other languages too. If you insist on an ORM, the best of the bunch is prisma https://www.prisma.io/ - outside of the typescript/javascript ecosystem it has ports for some other languages (with varying degrees of completion), the one I know about is the Rust one https://prisma.brendonovich.dev/introduction
In Ask HN: ORM or Native SQL?
I work heavily in this space and can add some more details :) Tusker actually uses Migra to power its functionality: https://github.com/bikeshedder/tusker#how-does-it-work Tusker's flow is somewhat similar to sqldef https://github.com/k0kubun/sqldef , although the internal mechanics are quite different. Migra/Tusker executes the SQL in a temporary location, introspects it, and diffs the introspected in-memory representation -- in other words, using the database directly as the canonical parser. In contrast, sqldef parses the SQL itself, builds an in-memory representation based on that, and then does the diff that way. I'm the author of Skeema https://www.skeema.io which provides a similar declarative workflow for MySQL and MariaDB schema changes. Skeema uses an execute-and-introspect approach similar to Migra/Tusker, although each object
Read the rest
is split out into its own .sql file for easier management in version control, with a multi-level directory hierarchy if you have multiple database instances and multiple schemas. Skeema was conceptually inspired by Facebook's internal database schema change flow, as FB has used declarative schema management submission/review/execution company-wide for over a decade now. Skeema actually predates both Migra and sqldef slightly, although it did not influence them, all were developed separately. In turn, Prisma Migrate and Vitess/PlanetScale declarative migrations were directly inspired by Skeema's approach, paradigms, and/or even direct use of source code in Vitess's case. (Although they're finally moving to a parser-based approach instead, which I recommended they do over a year ago, as it makes more sense for their use-case -- their whole product inherently requires a thorough SQL parser anyway... and ironically, sqldef is based on the Vitess SQL parser!)
In Migra: Diff for PostgreSQL schemas
This tool is incredibly useful I would also like to share a very similar tool that is much less known: https://github.com/bikeshedder/tusker It's the same thing, except instead of requiring two DB URL's to do the diffing, you give it a "schema.sql" file and a folder path that has your migrations in it, and the path to the current DB. Then it introspects the DB, looks at "schema.sql" + the migration files, and figures out what you've changed in "schema.sql" that isn't in your migrations yet and generates the diff as a new migration. Really amazing workflow. If you have trouble visualizing it, the workflow would be something like: 1. DB is empty, migrations empty, schema.sql has "CREATE TABLE todo (id int, description text);" 2. You run the diff, it generates a migration that contains the CREATE TABLE statement 3. You modify "
Read the rest
schema.sql", maybe adding a new column like "boolean is_completed" to "todo" 4. You re-run the diff, it sees the DB has the table, the migration for the table is present, but a new column is added. So it generates an "ALTER TABLE .. ADD COLUMN .." migration. 5. Rinse, repeat.
In Migra: Diff for PostgreSQL schemas

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.