diff options
Diffstat (limited to 'perl/Wallet/Server.pm')
-rw-r--r-- | perl/Wallet/Server.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/perl/Wallet/Server.pm b/perl/Wallet/Server.pm index 429b3fb..04e8fd9 100644 --- a/perl/Wallet/Server.pm +++ b/perl/Wallet/Server.pm @@ -85,6 +85,18 @@ sub initialize { return $class->new ($user, 'localhost'); } +# The same as initialize, but also drops any existing tables first before +# creating the schema. Takes the same arguments and throws an exception on +# failure. +sub reinitialize { + my ($class, $user) = @_; + my $dbh = $class->_open_db; + my $schema = Wallet::Schema->new; + $schema->drop ($dbh); + $dbh->disconnect; + return $class->initialize ($user); +} + # Create a new wallet server object. A new server should be created for each # user who is making changes to the wallet. Takes the principal and host who # are sending wallet requests. Opens a connection to the database that will @@ -752,6 +764,15 @@ privileged operations. On any error, this method throws an exception. +=item reinitialize(PRINCIPAL) + +Performs the same actions as initialize(), but first drops any existing +wallet database tables from the database, allowing this function to be +called on a prior wallet database. All data stored in the database will be +deleted and a fresh set of wallet database tables will be created. + +On any error, this method throws an exception. + =back =head1 INSTANCE METHODS |