From ee79913831be70fc51c193ea4118a15abb038a67 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 15 Jul 2014 22:07:48 -0700 Subject: Fix ordering of table drops on wallet-admin destroy Fix the ordering of table drops during a wallet-admin destroy action to remove tables with foreign key references before the tables they are referencing. Should fix destroy in MySQL and other database engines that enforce referential integrity. Change-Id: I9b37c516f67acdf1d9e25222f067df6749e8c769 Reviewed-on: https://gerrit.stanford.edu/1558 Reviewed-by: Russ Allbery Tested-by: Russ Allbery --- NEWS | 5 +++++ TODO | 2 -- perl/lib/Wallet/Admin.pm | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 4cf12b0..40efd3a 100644 --- a/NEWS +++ b/NEWS @@ -59,6 +59,11 @@ wallet 1.1 (unreleased) would just ignore the time. Now wallet-backend correctly requires the date and time be passed as a single argument. + Fix the ordering of table drops during a wallet-admin destroy action + to remove tables with foreign key references before the tables they + are referencing. Should fix destroy in MySQL and other database + engines that enforce referential integrity. + The initial creation and membership of the ADMIN ACL during database initialization or reinitialization is no longer recorded in the acl_history table. (This is fallout from making a specific type of diff --git a/TODO b/TODO index da526c6..a8d0aef 100644 --- a/TODO +++ b/TODO @@ -143,8 +143,6 @@ Database: * WALLET-31: On upgrades, support adding new object types and ACL verifiers to the class tables. - * WALLET-76: Fix wallet-admin destroy with MySQL. - Objects: * WALLET-32: Check whether we can just drop the realm restriction on diff --git a/perl/lib/Wallet/Admin.pm b/perl/lib/Wallet/Admin.pm index b07c7d1..8481979 100644 --- a/perl/lib/Wallet/Admin.pm +++ b/perl/lib/Wallet/Admin.pm @@ -170,9 +170,9 @@ sub destroy { # Get an actual DBI handle and use it to delete all tables. my $dbh = $self->dbh; - my @tables = qw/acls acl_entries acl_history acl_schemes duo enctypes - flags keytab_enctypes keytab_sync objects object_history - sync_targets types dbix_class_schema_versions/; + my @tables = qw/acl_entries object_history objects acls acl_history + acl_schemes enctypes flags keytab_enctypes keytab_sync sync_targets + duo types dbix_class_schema_versions/; for my $table (@tables) { my $sql = "DROP TABLE IF EXISTS $table"; $dbh->do ($sql); -- cgit v1.2.3