djrobstep / migra

Like diff but for PostgreSQL schemas
https://databaseci.com/docs/migra
The Unlicense
2.9k stars 123 forks source link

--ignore option #51

Open eradman opened 5 years ago

eradman commented 5 years ago

Is it possible to specify a list of object names to ignore? (regex or glob)

In some case I am using native PostgreSQL partitioning and it would be nice to ignore those when generating a schema diff.

djrobstep commented 5 years ago

There's no option for this currently but it really should be added. If you're using migra via the API you can work around this by changing the contents of the inspection objects manually yourself.

The partitioning case more generally is a big missing feature. High priority on the list of features to add, when I find the time!

eradman commented 5 years ago

My workaround was to restore the schema to an ephemeral database before running the comparison

tmp_url=$(pg_tmp)
pg_dump -T 'log_*' -s $db_url | psql -q $tmp_url
migra --unsafe $tmp_url ...

Here I used the -T option of pg_dump, but of course in a temporary database I can drop any other kind of object as well.

djrobstep commented 5 years ago

@eradman still haven't implemented an ignore option but have implemented partitioning support so you may not need to filter partitioned tables out manually any longer.

eradman commented 5 years ago

Thank you--partitioning support is even more useful than an ignore option.

tolmacevalexandr commented 4 years ago

It would be very convenient to have an option for excluding functions from migration. Because we use another utility to synchronize stored functions. We have a lot of changes in stored functions. These changes clog the output of the migra utility.