Subject: | translator > parser_args > sources bounce around in _source/deploy/X/001-auto.yml |
Something which has been annoying me for a while: when (re)generating the DDL the list of sources is in no consistent order. This causes git to detect changes even when there aren't any. From what I can tell SQL::Translator itself takes care not to let this happen, but in this case it's the input to SQL::Translator.
This small change fixes this issue:
--- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm
+++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm
@@ -589,7 +589,7 @@ sub prepare_deploy {
my $self = shift;
$self->prepare_protoschema({
# Exclude __VERSION so that it gets installed separately
- parser_args => { sources => [grep { $_ ne '__VERSION' } $self->schema->sources], }
+ parser_args => { sources => [sort { $a cmp $b } grep { $_ ne '__VERSION' } $self->schema->sources], }
}, '_ddl_protoschema_produce_filename');
$self->_prepare_install({}, '_ddl_protoschema_produce_filename', '_ddl_schema_produce_filename');
}