Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuoDB Producer #71

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions lib/SQL/Translator/Producer/NuoDB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ sub create_field
my $data_type = uc($dt_translate{lc($field->data_type)} || $field->data_type);
my $size = $field->size();

# NuoDB does not support WITHOUT TIME ZONE types
$data_type =~ s/ WITHOUT TIME ZONE//i;

my $field_def = "$field_name $data_type";
$field_def .= $field->is_auto_increment ?
' GENERATED BY DEFAULT AS IDENTITY' : '';
Expand Down
16 changes: 16 additions & 0 deletions t/65xml-to-nuodb-types.t
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ use SQL::Translator::Producer::NuoDB;
is_deeply(@result[0], $expected, 'NOW() stays NOW()');
}

# without time zone
{
my $table = SQL::Translator::Schema::Table->new(
name => 'foo_table',
);
$table->add_field(
name => 'c',
data_type => 'timestamp WITHOUT TIME ZONE',
is_nullable => 1,
);
my $expected = "CREATE TABLE foo_table (\n c TIMESTAMP\n);";
my @result = SQL::Translator::Producer::NuoDB::create_table($table);
is_deeply(@result[0], $expected, 'Ignore WITHOUT TIME ZONE');
}


# reserved word field
{
my $table = SQL::Translator::Schema::Table->new(
Expand Down