From 73600a19d58c110282be5307dbcc8479ab1d07bf Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Wed, 30 Jan 2013 18:52:07 -0800 Subject: Remove initialize and update code out of wallet-admin wallet-admin is solely a thin wrapper around Wallet::Admin, but it gained specific code for initialize and update, which caused the server/admin test to fail. Move the update code to set a default version into into Wallet::Admin instead. The initialize code appears to be unnecessary; it was setting a default for a parameter that was already handled by Wallet::Config. Change-Id: I1a7e5dbbfd005e4f60e89e50a91019295e44df99 Reviewed-on: https://gerrit.stanford.edu/729 Reviewed-by: Russ Allbery Tested-by: Russ Allbery --- perl/Wallet/Admin.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'perl/Wallet') diff --git a/perl/Wallet/Admin.pm b/perl/Wallet/Admin.pm index 511916d..d2e8cb0 100644 --- a/perl/Wallet/Admin.pm +++ b/perl/Wallet/Admin.pm @@ -1,7 +1,7 @@ # Wallet::Admin -- Wallet system administrative interface. # # Written by Russ Allbery -# Copyright 2008, 2009, 2010, 2011, 2012 +# Copyright 2008, 2009, 2010, 2011, 2012, 2013 # The Board of Trustees of the Leland Stanford Junior University # # See LICENSE for licensing terms. @@ -24,6 +24,12 @@ use Wallet::Schema; # that it will sort properly. $VERSION = '0.07'; +# The last non-DBIx::Class version of Wallet::Schema. If a database has no +# DBIx::Class versioning, we artificially install this version number before +# starting the upgrade process so that the automated DBIx::Class upgrade will +# work properly. +our $BASE_VERSION = '0.07'; + ############################################################################## # Constructor, destructor, and accessors ############################################################################## @@ -166,6 +172,13 @@ sub backup { sub upgrade { my ($self) = @_; + # Check to see if the database is versioned. If not, install the + # versioning table and default version. + if (!$self->{dbh}->get_db_version) { + $self->{dbh}->install ($BASE_VERSION); + } + + # Perform the actual upgrade. if ($self->{dbh}->get_db_version) { eval { $self->{dbh}->upgrade; }; } -- cgit v1.2.3