From 4338488b0410a87b553bfa7ae54b16837b108487 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Sun, 17 May 2020 22:17:36 -0700 Subject: Fix table drop order when destroying the database Fix the table drop order for wallet-admin destroy to avoid violating foreign key constraints. Patch from macrotex. --- NEWS | 3 +++ perl/lib/Wallet/Admin.pm | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 62c18bd..1a21c1a 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ wallet 1.5 (unreleased) + Fix the table drop order for wallet-admin destroy to avoid violating + foreign key constraints. Patch from macrotex. + Update to rra-c-util 8.2: * Implement explicit_bzero with memset if it is not available. diff --git a/perl/lib/Wallet/Admin.pm b/perl/lib/Wallet/Admin.pm index 630ac81..2b1a2f8 100644 --- a/perl/lib/Wallet/Admin.pm +++ b/perl/lib/Wallet/Admin.pm @@ -1,7 +1,7 @@ # Wallet::Admin -- Wallet system administrative interface # # Written by Russ Allbery -# Copyright 2016 Russ Allbery +# Copyright 2016, 2020 Russ Allbery # Copyright 2008-2014 # The Board of Trustees of the Leland Stanford Junior University # @@ -165,9 +165,11 @@ sub destroy { # Get an actual DBI handle and use it to delete all tables. my $dbh = $self->dbh; - 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/; + my @tables = qw( + acl_entries duo object_history objects acls acl_history acl_schemes + enctypes flags keytab_enctypes keytab_sync sync_targets types + dbix_class_schema_versions + ); for my $table (@tables) { my $sql = "DROP TABLE IF EXISTS $table"; $dbh->do ($sql); -- cgit v1.2.3