Added patch from user (RT#42548).
Ken Youens-Clark [Thu, 13 Aug 2009 15:21:29 +0000 (15:21 +0000)]
t/47postgres-producer.t

index 91749ea..55d3e17 100644 (file)
@@ -14,7 +14,7 @@ use FindBin qw/$Bin/;
 #=============================================================================
 
 BEGIN {
-    maybe_plan(22,
+    maybe_plan(24,
         'SQL::Translator::Producer::PostgreSQL',
         'Test::Differences',
     )
@@ -77,6 +77,42 @@ my $field3_sql = SQL::Translator::Producer::PostgreSQL::create_field($field3);
 
 is($field3_sql, 'time_field time NOT NULL', 'Create time field works');
 
+my $field3_datetime_with_TZ = SQL::Translator::Schema::Field->new(
+    name      => 'datetime_with_TZ',
+    table     => $table,
+    data_type => 'timestamp with time zone',
+    size      => 7,
+);
+
+my $field3_datetime_with_TZ_sql = 
+    SQL::Translator::Producer::PostgreSQL::create_field(
+        $field3_datetime_with_TZ
+    );
+
+is(
+    $field3_datetime_with_TZ_sql, 
+    'datetime_with_TZ timestamp(6) with time zone', 
+    'Create time field with time zone and size, works'
+);
+
+my $field3_time_without_TZ = SQL::Translator::Schema::Field->new(
+    name      => 'time_without_TZ',
+    table     => $table,
+    data_type => 'time without time zone',
+    size      => 2,
+);
+
+my $field3_time_without_TZ_sql 
+    = SQL::Translator::Producer::PostgreSQL::create_field(
+        $field3_time_without_TZ
+    );
+
+is(
+    $field3_time_without_TZ_sql, 
+    'time_without_TZ time(2) without time zone', 
+    'Create time field without time zone but with size, works'
+);
+
 my $field4 = SQL::Translator::Schema::Field->new( name      => 'bytea_field',
                                                   table => $table,
                                                   data_type => 'bytea',