Rename table crash_datas to crash_report_datas
authorVincent Tondellier <tonton+hg@team1664.org>
Sun, 27 Sep 2015 22:44:26 +0200
changeset 76 6a33901e2721
parent 75 e3912669678c
child 77 e408da1419cd
Rename table crash_datas to crash_report_datas
dbicdh/PostgreSQL/deploy/2/002-extract_crashing_functions.sql
lib/CrashTest/Storage/Sql.pm
lib/CrashTest/Storage/Sql/Schema/Result/CrashData.pm
lib/CrashTest/Storage/Sql/Schema/Result/CrashReport.pm
lib/CrashTest/Storage/Sql/Schema/Result/CrashReportData.pm
--- a/dbicdh/PostgreSQL/deploy/2/002-extract_crashing_functions.sql	Thu Sep 24 01:49:55 2015 +0200
+++ b/dbicdh/PostgreSQL/deploy/2/002-extract_crashing_functions.sql	Sun Sep 27 22:44:26 2015 +0200
@@ -16,7 +16,7 @@
 
 -- Used for searching function in the crashing thread backtrace
 -- Search will be really slow if this index is not present
-CREATE INDEX crash_datas_idx_extract_crashing_functions ON crash_datas USING gin (
-    extract_crashing_functions(processed) gin_trgm_ops
+CREATE INDEX crash_report_datas_idx_extract_crashing_functions ON crash_report_datas USING gist (
+    extract_crashing_functions(processed) gist_trgm_ops
 );
 
--- a/lib/CrashTest/Storage/Sql.pm	Thu Sep 24 01:49:55 2015 +0200
+++ b/lib/CrashTest/Storage/Sql.pm	Sun Sep 27 22:44:26 2015 +0200
@@ -68,7 +68,7 @@
         $dbic_query,
         {
             prefetch    => 'product',
-            join        => [ qw/crash_user crash_data/ ],
+            join        => [ qw/crash_user crash_report_data/ ],
             '+select'   => \@select,
             '+as'       => \@sel_as,
             order_by    => { -desc => 'crash_time' },
@@ -147,7 +147,7 @@
         }
 
         my $txt_json = j($pjson);
-        $crash->create_related('crash_data', {
+        $crash->create_related('crash_report_data', {
                 processed => $txt_json,
             });
 
@@ -166,10 +166,10 @@
 
     my $crash = $self->{schema}->resultset('CrashReport')->search(
         { uuid => $uuid },
-        { prefetch => 'crash_data' }
+        { prefetch => 'crash_report_data' }
     )->first();
 
-    return decode_json($crash->crash_data->processed);
+    return decode_json($crash->crash_report_data->processed);
 }
 
 1;
--- a/lib/CrashTest/Storage/Sql/Schema/Result/CrashData.pm	Thu Sep 24 01:49:55 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-package CrashTest::Storage::Sql::Schema::Result::CrashData;
-
-use CrashTest::Storage::Sql::Schema::Candy;
-
-primary_column id => {
-    data_type => 'int',
-    is_auto_increment => 1,
-};
-
-column processed => {
-    data_type => 'jsonb',
-};
-
-column crash_report_id => { data_type => 'int' };
-belongs_to crash_report => 'CrashTest::Storage::Sql::Schema::Result::CrashReport', 'crash_report_id';
-
-1;
--- a/lib/CrashTest/Storage/Sql/Schema/Result/CrashReport.pm	Thu Sep 24 01:49:55 2015 +0200
+++ b/lib/CrashTest/Storage/Sql/Schema/Result/CrashReport.pm	Sun Sep 27 22:44:26 2015 +0200
@@ -43,7 +43,7 @@
     is_nullable => 1,
 };
 
-has_one crash_data => 'CrashTest::Storage::Sql::Schema::Result::CrashData', 'crash_report_id';
+has_one crash_report_data => 'CrashTest::Storage::Sql::Schema::Result::CrashReportData', 'crash_report_id';
 
 column crash_user_id => { data_type => 'int' };
 belongs_to crash_user => 'CrashTest::Storage::Sql::Schema::Result::CrashUser', 'crash_user_id';
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/CrashTest/Storage/Sql/Schema/Result/CrashReportData.pm	Sun Sep 27 22:44:26 2015 +0200
@@ -0,0 +1,30 @@
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+package CrashTest::Storage::Sql::Schema::Result::CrashReportData;
+
+use CrashTest::Storage::Sql::Schema::Candy;
+
+primary_column id => {
+    data_type => 'int',
+    is_auto_increment => 1,
+};
+
+column processed => {
+    data_type => 'jsonb',
+};
+
+column crash_report_id => { data_type => 'int' };
+belongs_to crash_report => 'CrashTest::Storage::Sql::Schema::Result::CrashReport', 'crash_report_id';
+
+1;