Generate with cargo build

Would it be a good idea to generate when running cargo build and not keep track of inside of a VCS?

If so what would be the best way? What would the look like (if it is used)?

Normally is meant to be included in your VCS, because it represents something at the current code status that does not change randomly.

If you really want to generate it at build time running diesel print-schema via shell command is probably the easiest way.

Isn’t that the whole point of migrations though? Doesn’t that make it redundant?

At least in my opinion having a in your VCS is not redundant, because migrations are not required. (For example you could develop against a existing database).
Anyway we’ve currently no plan to split out the print-schema related code from diesel-cli, which would be required to support generating the schema from a without calling a shell command. If anyone want’s to do that as a third party crate, go for it.


I never thought of this though and I don’t think it would be useful regardless of whether is redundant or not.