From 14e2c95a830eb4206390a58f85b4bc49068f23cd Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 4 Mar 2026 15:27:12 +0100 Subject: [PATCH] fix: only drop Vikunja-owned tables in WipeEverything Previously WipeEverything used x.DBMetas() which returns all tables in the database, including those owned by PostgreSQL extensions like PostGIS. This caused restore to fail with 'cannot drop table spatial_ref_sys because extension postgis requires it'. Now uses the registered table list instead. Fixes go-vikunja/vikunja#2219 --- pkg/db/db.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pkg/db/db.go b/pkg/db/db.go index 8091c5ef9..a31d5a8fb 100644 --- a/pkg/db/db.go +++ b/pkg/db/db.go @@ -428,16 +428,10 @@ func isSystemDirectory(path string) bool { return false } -// WipeEverything wipes all tables and their data. Use with caution... +// WipeEverything wipes all Vikunja tables and their data. Use with caution... func WipeEverything() error { - - tables, err := x.DBMetas() - if err != nil { - return err - } - - for _, t := range tables { - if err := x.DropTables(t.Name); err != nil { + for _, name := range RegisteredTableNames() { + if err := x.DropTables(name); err != nil { return err } }