dbsrgits / sql-translator

SQL::Translator (SQLFairy)
http://sqlfairy.sourceforge.net/
82 stars 91 forks source link

Add support for retrieving all constraints via DBI::Postgresql #167

Open rabbiveesh opened 8 months ago

rabbiveesh commented 8 months ago

Right now, when generating a schema from your database, we only pull foreign key constraints. It's not that hard to pull the other types of constraints, too (you search the pg_catalog.pg_constraint on different contype where f is fk, x is exclue, u is unique, c is check etc). Then, you can use the pg_get_constraintdef to recover the DDL for generating it, which we SHOULD be able to just parse using the regular parser