[Rt-commit] rt branch, 4.4/drop-unused-columns, updated. rt-4.2.0-36-g835e1d8
Shawn Moore
shawn at bestpractical.com
Fri May 15 17:53:40 EDT 2015
The branch, 4.4/drop-unused-columns has been updated
via 835e1d8b521f13404e28383b70fb73780203fc14 (commit)
via b527eb9e9fc1bd2d5f447ac58f817a7c405e6594 (commit)
from 04ffee6202af1bdd6488fe2def3a439d174c8000 (commit)
Summary of changes:
etc/upgrade/4.3.0/{content => begin} | 0
sbin/rt-setup-database.in | 21 +++++++++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
rename etc/upgrade/4.3.0/{content => begin} (100%)
- Log -----------------------------------------------------------------
commit b527eb9e9fc1bd2d5f447ac58f817a7c405e6594
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Fri May 15 21:46:07 2015 +0000
Add a "begin" upgrade step for validation
This is required because the right place to add arbitrary upgrade code is
"content", yet that always runs after schema changes, which may be
too late (as in 4.3.0's column dropping).
diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index 0995457..995f590 100644
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -355,10 +355,19 @@ sub action_insert {
my ($status, $msg) = RT::Handle->CheckCompatibility( $RT::Handle->dbh, 'insert' );
return ($status, $msg) unless $status;
- print "Now inserting data.\n";
- my $file = $args{'datafile'};
- $file = $RT::EtcPath . "/initialdata" if $init && !$file;
- $file ||= $args{'datadir'}."/content";
+ my $file;
+
+ if ($args{begin_step}) {
+ print "Now running begin step.\n";
+ $file = $args{'datafile'};
+ $file ||= $args{'datadir'}."/begin";
+ }
+ else {
+ print "Now inserting data.\n";
+ $file = $args{'datafile'};
+ $file = $RT::EtcPath . "/initialdata" if $init && !$file;
+ $file ||= $args{'datadir'}."/content";
+ }
my $individual_id = Data::GUID->new->as_string();
my %upgrade_data = (
@@ -543,6 +552,10 @@ sub action_upgrade {
my %tmp = (%args, datadir => "$base_dir/$v", datafile => undef, backcompat => \@back);
+ if ( -e "$base_dir/$v/begin" ) {
+ ( $ret, $msg ) = action_insert( %tmp, begin_step => 1 );
+ return ( $ret, $msg ) unless $ret;
+ }
if ( -e "$base_dir/$v/schema.$db_type" ) {
( $ret, $msg ) = action_schema( %tmp );
return ( $ret, $msg ) unless $ret;
commit 835e1d8b521f13404e28383b70fb73780203fc14
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Fri May 15 21:52:40 2015 +0000
Move the 4.3.0 validation from after to before schema change
This way, we really do throw an error if there is any data in the
moribund columns
diff --git a/etc/upgrade/4.3.0/content b/etc/upgrade/4.3.0/begin
similarity index 100%
rename from etc/upgrade/4.3.0/content
rename to etc/upgrade/4.3.0/begin
-----------------------------------------------------------------------
More information about the rt-commit
mailing list