4

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.

2
  • 1
    What would the input to the script be? Do you have a schema file somewhere? Would it have to compare two schema files? Commented Sep 28, 2009 at 9:19
  • Yes I have a schema file more a create script. Commented Sep 28, 2009 at 9:41

3 Answers 3

3

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

Sign up to request clarification or add additional context in comments.

3 Comments

Interesting. But for what I can tell by the list of packages, postgresql may not be supported.
Under Features section it says "Works with Postgres, MySQL, and SQLite2". The list of packages you're referring to is to "handle quirks" in MySQL and SQLite2 ;-)
draegtun. Good to know. It just didn't occur to me that there's a single SQL that has no quirks to handle ;-) But then if it was a reference platform... +1 then ;-)
3

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.

Comments

0

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:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.