[Rt-commit] rt branch, 4.4/drop-unused-columns, updated. rt-4.2.0-34-g87b8bef
Shawn Moore
shawn at bestpractical.com
Fri May 15 17:24:08 EDT 2015
The branch, 4.4/drop-unused-columns has been updated
via 87b8bef0a9662b58dc86fd14c3aa7039ab056a05 (commit)
from e5f8c8eaa7fd19625b1d67540aea378fe55ee5b3 (commit)
Summary of changes:
etc/upgrade/4.3.0/content | 54 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 etc/upgrade/4.3.0/content
- Log -----------------------------------------------------------------
commit 87b8bef0a9662b58dc86fd14c3aa7039ab056a05
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Fri May 15 21:20:05 2015 +0000
Bail out if a column we'll drop has any values
The last thing I want is an angry email saying we dropped a
column filled with irreplaceable data
diff --git a/etc/upgrade/4.3.0/content b/etc/upgrade/4.3.0/content
new file mode 100644
index 0000000..ebceb42
--- /dev/null
+++ b/etc/upgrade/4.3.0/content
@@ -0,0 +1,54 @@
+use strict;
+use warnings;
+
+our @Initial = (
+ sub {
+ RT->Logger->debug('Make sure all columns we are about to drop are empty');
+
+ # Tickets
+ for my $column (qw/IssueStatement Resolution/) {
+ my $tickets = RT::Tickets->new(RT->SystemUser);
+ $tickets->Limit(
+ FIELD => $column,
+ OPERATOR => '!=',
+ VALUE => '',
+ ENTRYAGGREGATOR => 'AND',
+ );
+ $tickets->Limit(
+ FIELD => $column,
+ OPERATOR => 'IS NOT',
+ VALUE => 'NULL',
+ ENTRYAGGREGATOR => 'AND',
+ );
+
+ if ($tickets->Count) {
+ die "You have " . $tickets->Count . " ticket(s) with a non-empty value for column '$column'. Core RT does not use this column, so perhaps an extension or local modification makes use of it. Please migrate these ticket values to a custom field or an attribute.";
+ }
+ }
+
+ # Users
+ for my $column (qw/
+ EmailEncoding WebEncoding ExternalContactInfoId
+ ContactInfoSystem ExternalAuthId AuthSystem PGPKey
+ /) {
+ my $users = RT::Users->new(RT->SystemUser);
+ $users->Limit(
+ FIELD => $column,
+ OPERATOR => '!=',
+ VALUE => '',
+ ENTRYAGGREGATOR => 'AND',
+ );
+ $users->Limit(
+ FIELD => $column,
+ OPERATOR => 'IS NOT',
+ VALUE => 'NULL',
+ ENTRYAGGREGATOR => 'AND',
+ );
+
+ if ($users->Count) {
+ die "You have " . $users->Count . " users(s) with a non-empty value for column '$column'. Core RT does not use this column, so perhaps an extension or local modification makes use of it. Please migrate these user values to a custom field or an attribute.";
+ }
+ }
+ },
+);
+
-----------------------------------------------------------------------
More information about the rt-commit
mailing list