gustavgans
gustavgans

Reputation: 5191

Is there a script for generating a migration SQL (postgres) file?

On a project I work I have sometimes have to deal with changes on the table structure, like adding fields. Is there a script that can I use for generate a migration SQL file with only the changes?

PHP, bash or Perl would be nice. The database is postgresql.

Upvotes: 4

Views: 2927

Answers (3)

draegtun
draegtun

Reputation: 22570

Looking on CPAN there is this module which appears to fit the bill: DBIx::Migration::Directories.

Upvotes: 3

Michael Krelin - hacker
Michael Krelin - hacker

Reputation: 143239

I only know this - Another PostgreSQL Diff Tool (it's java, though), but personally I don't trust computers that much and prefer hand-crafted update scripts.

Upvotes: 3

kupgov
kupgov

Reputation: 393

Now similar question with answers in DBA exists: https://dba.stackexchange.com/questions/73846/postgresql-schema-diff-patch-tool

In particular it's offered the next variants:

Upvotes: 0

Related Questions