[Rt-commit] rt branch, 5.0/fix-oracle, created. rt-5.0.0alpha1-435-g85ef69cc3f

? sunnavy sunnavy at bestpractical.com
Wed May 13 16:05:08 EDT 2020


The branch, 5.0/fix-oracle has been created
        at  85ef69cc3f6da46141cd8afceb28dc03b02f1767 (commit)

- Log -----------------------------------------------------------------
commit 9ee3646cdbc2a78c9c37b8943b6dc2890892a437
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu May 14 01:14:54 2020 +0800

    Drop unique constraint of Configurations Name column for Oracle
    
    We added Disabled column and now old configurations are kept in db.
    
    See also 039be68775

diff --git a/etc/schema.Oracle b/etc/schema.Oracle
index 2b366299cf..47854c5c74 100644
--- a/etc/schema.Oracle
+++ b/etc/schema.Oracle
@@ -542,7 +542,7 @@ CREATE UNIQUE INDEX ObjectCustomRoles1 ON ObjectCustomRoles (ObjectId, CustomRol
 CREATE SEQUENCE Configurations_seq;
 CREATE TABLE Configurations (
     id              NUMBER(11,0)    CONSTRAINT Configurations_key PRIMARY KEY,
-    Name            VARCHAR2(255) CONSTRAINT Configurations_Name_Unique unique  NOT NULL,
+    Name            VARCHAR2(255) NOT NULL,
     Content         CLOB,
     ContentType     VARCHAR2(80),
     Disabled        NUMBER(11,0) DEFAULT 0 NOT NULL,
diff --git a/etc/upgrade/4.5.8/schema.Oracle b/etc/upgrade/4.5.8/schema.Oracle
new file mode 100644
index 0000000000..0f7e6e4133
--- /dev/null
+++ b/etc/upgrade/4.5.8/schema.Oracle
@@ -0,0 +1 @@
+ALTER TABLE Configurations DROP CONSTRAINT Configurations_Name_Unique;

commit b74a252e8f64917d28faedfc3b9d3f9809b26fa4
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu May 14 01:20:17 2020 +0800

    Add parens because . has higher precedence than ||
    
    We caught this issue because of uninitialized warnings when we ran tests
    on Oracle.

diff --git a/share/html/Elements/SelectArticle b/share/html/Elements/SelectArticle
index 302ec7732e..415f99f341 100644
--- a/share/html/Elements/SelectArticle
+++ b/share/html/Elements/SelectArticle
@@ -54,7 +54,7 @@
 % while (my $article = $articles->Next) {
 <option <% ( $article->Name eq $Default) ? qq[ selected="selected"] : '' |n %>
     value="<%$article->Id%>">
-<%$article->Name || loc('(no name)')%><% $IncludeSummary ? ': ' . $article->Summary || '' : '' %>
+<%$article->Name || loc('(no name)')%><% $IncludeSummary ? ': ' .  ($article->Summary || '') : '' %>
 </option>
 % }
 </select>

commit 9223d74b03b024f0641c7636546190e668a35dfa
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu May 14 01:33:56 2020 +0800

    Get rid of uninitialized warnings on Oracle
    
    Because of the known behavior that Oracle treats empty strings as NULL

diff --git a/lib/RT/REST2/Resource/CustomField.pm b/lib/RT/REST2/Resource/CustomField.pm
index 96fe15e58a..3e3aaf5524 100644
--- a/lib/RT/REST2/Resource/CustomField.pm
+++ b/lib/RT/REST2/Resource/CustomField.pm
@@ -79,7 +79,7 @@ sub serialize {
     if ($data->{Values}) {
         if ($self->record->BasedOn && defined $self->request->param('category')) {
             my $category = $self->request->param('category') || '';
-            @{$data->{Values}} = grep {$_->{category} eq $category} @{$data->{Values}};
+            @{ $data->{Values} } = grep { ( $_->{category} // '' ) eq $category } @{ $data->{Values} };
         }
         @{$data->{Values}} = map {$_->{name}} @{$data->{Values}};
     }

commit 268f4b96ca030ecf48a60196f5efde7f70088a49
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu May 14 01:36:28 2020 +0800

    Give fields true values to make REST2 tests happy on Oracle
    
    Oracle treats empty strings as NULL, and in REST2 response we excludes
    undef values, thus tests like:
    
        ok(exists $content->{Description})
    
    would fail.

diff --git a/t/rest2/assets.t b/t/rest2/assets.t
index 6c0d32f7f5..1f1712bfed 100644
--- a/t/rest2/assets.t
+++ b/t/rest2/assets.t
@@ -41,6 +41,7 @@ my ($asset_url, $asset_id);
 {
     my $payload = {
         Name    => 'Asset creation using REST',
+        Description => 'Asset description',
         Catalog => 'General assets',
         Content => 'Testing asset creation using REST API.',
     };
diff --git a/t/rest2/queues.t b/t/rest2/queues.t
index 758ee7f26c..5ab1049168 100644
--- a/t/rest2/queues.t
+++ b/t/rest2/queues.t
@@ -9,7 +9,11 @@ my $user = RT::Test::REST2->user;
 
 $user->PrincipalObj->GrantRight( Right => 'SuperUser' );
 
-my $queue_obj = RT::Test->load_or_create_queue( Name => "General" );
+my $queue_obj = RT::Test->load_or_create_queue(
+    Name              => "General",
+    CorrespondAddress => 'general at example.com',
+    CommentAddress    => 'comment at example.com',
+);
 
 my $single_cf = RT::CustomField->new( RT->SystemUser );
 

commit 85ef69cc3f6da46141cd8afceb28dc03b02f1767
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu May 14 01:39:43 2020 +0800

    Use is_empty to make tests happy on Oracle
    
    These values are undef on Oracle because Oracle doesn't support empty
    strings.

diff --git a/t/rest2/customfields.t b/t/rest2/customfields.t
index ea52d00ad3..61968f48d3 100644
--- a/t/rest2/customfields.t
+++ b/t/rest2/customfields.t
@@ -67,7 +67,7 @@ my $freeform_cf_id;
     $freeform_cf->Load('Freeform CF');
     $freeform_cf_id = $freeform_cf->id;
     is($freeform_cf->id, 4);
-    is($freeform_cf->Description, '');
+    is_empty($freeform_cf->Description);
 }
 
 
@@ -125,7 +125,7 @@ my $freeform_cf_id;
     my $content = $mech->json_response;
     is($content->{id}, $freeform_cf_id);
     is($content->{Name}, $freeform_cf->Name);
-    is($content->{Description}, '');
+    is_empty($content->{Description});
     is($content->{LookupType}, 'RT::Queue-RT::Ticket');
     is($content->{Type}, 'Freeform');
     is($content->{MaxValues}, 1);
@@ -152,7 +152,7 @@ my $freeform_cf_id;
     my $content = $mech->json_response;
     is($content->{id}, $select_cf_id);
     is($content->{Name}, $select_cf->Name);
-    is($content->{Description}, '');
+    is_empty($content->{Description});
     is($content->{LookupType}, 'RT::Queue-RT::Ticket');
     is($content->{Type}, 'Select');
     is($content->{MaxValues}, 1);
@@ -185,7 +185,7 @@ my $freeform_cf_id;
     my $content = $mech->json_response;
     is($content->{id}, $basedon_cf_id);
     is($content->{Name}, $basedon_cf->Name);
-    is($content->{Description}, '');
+    is_empty($content->{Description});
     is($content->{LookupType}, 'RT::Queue-RT::Ticket');
     is($content->{Type}, 'Select');
     is($content->{MaxValues}, 1);
@@ -218,7 +218,7 @@ my $freeform_cf_id;
     my $content = $mech->json_response;
     is($content->{id}, $basedon_cf_id);
     is($content->{Name}, $basedon_cf->Name);
-    is($content->{Description}, '');
+    is_empty($content->{Description});
     is($content->{LookupType}, 'RT::Queue-RT::Ticket');
     is($content->{Type}, 'Select');
     is($content->{MaxValues}, 1);
@@ -251,7 +251,7 @@ my $freeform_cf_id;
     my $content = $mech->json_response;
     is($content->{id}, $basedon_cf_id);
     is($content->{Name}, $basedon_cf->Name);
-    is($content->{Description}, '');
+    is_empty($content->{Description});
     is($content->{LookupType}, 'RT::Queue-RT::Ticket');
     is($content->{Type}, 'Select');
     is($content->{MaxValues}, 1);
@@ -287,7 +287,7 @@ my $freeform_cf_id;
     my $content = $mech->json_response;
     is($content->{id}, $freeform_cf_id);
     is($content->{Name}, 'Freeform CF');
-    is($content->{Description}, '');
+    is_empty($content->{Description});
     is($content->{LookupType}, 'RT::Queue-RT::Ticket');
     is($content->{Type}, 'Freeform');
     is($content->{MaxValues}, 1);

-----------------------------------------------------------------------


More information about the rt-commit mailing list