Hacker News new | ask | show | jobs
by fiatjaf 2820 days ago
What I want: an SQL (actually, it could be just Postgres as I only use that) parser that takes two schema declarations and calculates the commands needed to go from one to the other, so we can have automatic migrations.

For example, if A is

  CREATE TABLE person (
    id serial PRIMARY KEY,
    name text
  )
and B is

  CREATE TABLE person (
    id serial PRIMARY KEY,
    name text,
    age int
  )
Then this tool would output

  ALTER TABLE person ADD COLUMN age int