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
This commit is contained in:
parent
0a8534ded9
commit
14e2c95a83
12
pkg/db/db.go
12
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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue