[Rt-commit] rt branch, 4.4/validator-delete-more-dangling-txns, created. rt-4.4.2-241-gd24f46c0b

? sunnavy sunnavy at bestpractical.com
Thu May 31 15:44:42 EDT 2018


The branch, 4.4/validator-delete-more-dangling-txns has been created
        at  d24f46c0b005e08d0925bfcf5ff30f6310f51d20 (commit)

- Log -----------------------------------------------------------------
commit f6a41fced1416776e219c3a5a6f9010d45ccdb99
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 1 02:15:38 2018 +0800

    Allow rt-validator to delete txns of reminder changes but reminders don't exist

diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index 30ab1d2c5..956235a63 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -844,6 +844,15 @@ push @CHECKS, 'Transactions -> other' => sub {
         join_condition => 't.Type = ?',
         condition      => 's.Type IN (?, ?, ?)',
         bind_values    => [ 'reminder', 'AddReminder', 'OpenReminder', 'ResolveReminder' ],
+        action => sub {
+            my $id = shift;
+            return unless prompt(
+                'Delete', "Found a transaction describing a reminder change,"
+                ." but the reminder doesn't exist anymore."
+            );
+
+            delete_record( 'Transactions', $id );
+        },
     );
     return $res;
 };

commit 9a1337327a9ff00ecd2c0cd704c6fb03ad895e29
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 1 02:47:06 2018 +0800

    Allow rt-validator to delete txns of cf changes but cfs don't exist

diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index 956235a63..ac3535028 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -745,6 +745,15 @@ push @CHECKS, 'Transactions -> other' => sub {
         'Transactions', 'Field' => 'CustomFields', 'id',
         condition   => 's.Type = ?',
         bind_values => [ 'CustomField' ],
+        action => sub {
+            my $id = shift;
+            return unless prompt(
+                'Delete', "Found a transaction describing a custom field change,"
+                ." but the custom field doesn't exist anymore."
+            );
+
+            delete_record( 'Transactions', $id );
+        },
     );
     # type = Take, Untake, Force, Steal or Give
     $res *= check_integrity(

commit d24f46c0b005e08d0925bfcf5ff30f6310f51d20
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 1 02:57:39 2018 +0800

    Let rt-validator check more owner change txns
    
    "Give" was renamed to "Set" in 4.0, SetWatcher was added in 4.2.

diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index ac3535028..1b61d6af7 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -756,10 +756,11 @@ push @CHECKS, 'Transactions -> other' => sub {
         },
     );
     # type = Take, Untake, Force, Steal or Give
+    # or, type = Set, SetWatcher, field = Owner
     $res *= check_integrity(
         'Transactions', 'OldValue' => 'Users', 'id',
-        condition   => 's.Type IN (?, ?, ?, ?, ?)',
-        bind_values => [ qw(Take Untake Force Steal Give) ],
+        condition   => 's.Type IN (?, ?, ?, ?, ?) OR ( s.Type IN (?, ?) AND s.Field = ? )',
+        bind_values => [ qw(Take Untake Force Steal Give), qw(Set SetWatcher Owner) ],
         action => sub {
             my $id = shift;
             return unless prompt(
@@ -772,8 +773,8 @@ push @CHECKS, 'Transactions -> other' => sub {
     );
     $res *= check_integrity(
         'Transactions', 'NewValue' => 'Users', 'id',
-        condition   => 's.Type IN (?, ?, ?, ?, ?)',
-        bind_values => [ qw(Take Untake Force Steal Give) ],
+        condition   => 's.Type IN (?, ?, ?, ?, ?) OR ( s.Type IN ( ?, ? ) AND s.Field = ? )',
+        bind_values => [ qw(Take Untake Force Steal Give), qw(Set SetWatcher Owner) ],
         action => sub {
             my $id = shift;
             return unless prompt(

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


More information about the rt-commit mailing list