From: Justin Hunter Date: Tue, 11 Aug 2009 04:50:00 +0000 (-0700) Subject: change from data_type (freeform text) to sql_data_type (dbi constant) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=98ec245a9a219b5d7e6d229db6d87dcbca873eaf;p=dbsrgits%2FSQL-Translator-2.0-ish.git change from data_type (freeform text) to sql_data_type (dbi constant) --- diff --git a/lib/SQL/Translator/Producer/SQL/PostgreSQL.pm b/lib/SQL/Translator/Producer/SQL/PostgreSQL.pm index edef6f9..f7152ee 100644 --- a/lib/SQL/Translator/Producer/SQL/PostgreSQL.pm +++ b/lib/SQL/Translator/Producer/SQL/PostgreSQL.pm @@ -34,8 +34,8 @@ role SQL::Translator::Producer::SQL::PostgreSQL { my $column_def; $column_def = $column->name . ' '; - $column_def .= defined $self->data_type_mapping->{$column->data_type} - ? $self->data_type_mapping->{$column->data_type} + $column_def .= defined $self->data_type_mapping->{$column->sql_data_type} + ? $self->data_type_mapping->{$column->sql_data_type} : $column->data_type; $column_def .= '(' . $column->size . ')' if $size; $column_def .= ' NOT NULL' unless $column->is_nullable; diff --git a/lib/SQL/Translator/Producer/SQL/SQLite.pm b/lib/SQL/Translator/Producer/SQL/SQLite.pm index f4f093a..fb4ebc6 100644 --- a/lib/SQL/Translator/Producer/SQL/SQLite.pm +++ b/lib/SQL/Translator/Producer/SQL/SQLite.pm @@ -28,14 +28,14 @@ role SQL::Translator::Producer::SQL::SQLite { } method _create_column(Column $column) { - my $size = $column->data_type == SQL_TIMESTAMP() ? undef : $column->size; + my $size = $column->sql_data_type == SQL_TIMESTAMP() ? undef : $column->size; my $default_value = $column->default_value; $default_value =~ s/^now[()]*/CURRENT_TIMESTAMP/i if $default_value; my $column_def; $column_def = $column->name . ' '; - $column_def .= defined $self->data_type_mapping->{$column->data_type} - ? $self->data_type_mapping->{$column->data_type} + $column_def .= defined $self->data_type_mapping->{$column->sql_data_type} + ? $self->data_type_mapping->{$column->sql_data_type} : $column->data_type; #$column_def .= '(' . $column->size . ')' if $size; $column_def .= ' NOT NULL' unless $column->is_nullable;