using software limit emulation
- create_ddl_dir (and derivatives) now attempt to create the given
$ddl_dir if it does not already exist
+ - deployment_statements now automatically supplies the current RDBMS
+ version to SQLT producer_args for MySQL, Pg, SQLite and Oracle
* Fixes
- Fix nasty potentially data-eating bug when deleting/updating
The solution is to use the smallest practical value for LongReadLen.
-=head2 create_ddl_dir does not produce DDL for MySQL views
-
-L<SQL::Translator> does not create DDL for MySQL views if it doesn't know you
-are using mysql version 5.000001 or higher. To explicity set this version, add
-C<mysql_version> to the C<producer_args> in the C<%sqlt> options.
-
- $schema->create_ddl_dir(['MySQL'], '1.0', './sql/', undef, { producer_args => { mysql_version => 5.000058 } })
-
=cut
$sqltargs->{quote_table_names} = $quote_char ? 1 : 0;
$sqltargs->{quote_field_names} = $quote_char ? 1 : 0;
- my $oracle_version = try { $self->_get_dbh->get_info(18) };
-
- $sqltargs->{producer_args}{oracle_version} = $oracle_version;
+ if (
+ ! exists $sqltargs->{producer_args}{oracle_version}
+ and
+ my $dver = $self->_server_info->{dbms_version}
+ ) {
+ $sqltargs->{producer_args}{oracle_version} = $dver;
+ }
$self->next::method($schema, $type, $version, $dir, $sqltargs, @rest);
}
$sqltargs ||= {};
- if (my $version = $self->_server_info->{dbms_version}) {
- $sqltargs->{producer_args}{postgres_version} = $version;
+ if (
+ ! exists $sqltargs->{producer_args}{postgres_version}
+ and
+ my $dver = $self->_server_info->{normalized_dbms_version}
+ ) {
+ $sqltargs->{producer_args}{postgres_version} = $dver;
}
$self->next::method($schema, $type, $version, $dir, $sqltargs, @rest);
}
sub deployment_statements {
- my $self = shift;;
+ my $self = shift;
my ($schema, $type, $version, $dir, $sqltargs, @rest) = @_;
$sqltargs ||= {};
- if (my $version = $self->_server_info->{dbms_version}) {
- $sqltargs->{producer_args}{sqlite_version} = $version;
+ if (
+ ! exists $sqltargs->{producer_args}{sqlite_version}
+ and
+ my $dver = $self->_server_info->{normalized_dbms_version}
+ ) {
+ $sqltargs->{producer_args}{sqlite_version} = $dver;
}
$self->next::method($schema, $type, $version, $dir, $sqltargs, @rest);
return 'MySQL';
}
+sub deployment_statements {
+ my $self = shift;
+ my ($schema, $type, $version, $dir, $sqltargs, @rest) = @_;
+
+ $sqltargs ||= {};
+
+ if (
+ ! exists $sqltargs->{producer_args}{mysql_version}
+ and
+ my $dver = $self->_server_info->{normalized_dbms_version}
+ ) {
+ $sqltargs->{producer_args}{mysql_version} = $dver;
+ }
+
+ $self->next::method($schema, $type, $version, $dir, $sqltargs, @rest);
+}
+
sub _svp_begin {
my ($self, $name) = @_;