rust-db / refinery

Powerful SQL migration toolkit for Rust.
MIT License
1.35k stars 126 forks source link

Get final database schema after all migrations are run #305

Open vasilakisfil opened 10 months ago

vasilakisfil commented 10 months ago

Migrations are just diffs over time, not the final state of the database schema nor the source of truth. The actual database schema, after running all migrations, is the source of truth. Is there a way to get that using refinery, in an sql or barrel format ?

I guess an alternative is to use pg_dump and specify --schema-only but would be great if refinery could extract that from all migrations somehow.

jxs commented 10 months ago

Hi, and thanks for your interest! Can you give a practical use case for this change?

vasilakisfil commented 10 months ago
jxs commented 9 months ago

yeah makes sense, I think we can have a function in the runner that dumps the schema would you be interested in implementing it?