[PR #2355] [MERGED] fix: only operate on Vikunja-owned tables in Dump and WipeEverything #9924

Closed
opened 2026-04-23 09:17:28 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2355
Author: @tink-bot
Created: 3/4/2026
Status: Merged
Merged: 3/4/2026
Merged by: @kolaente

Base: mainHead: fix-dump-extension-tables


📝 Commits (5)

  • 7273bc4 feat: add table registration to db package
  • dde1668 feat: register Vikunja tables with db package at init
  • a662cfd feat: add RegisteredTableNames helper to db package
  • 65dfb30 fix: only drop Vikunja-owned tables in WipeEverything
  • 68e3506 fix: only dump Vikunja-owned tables

📊 Changes

7 files changed (+57 additions, -18 deletions)

View changed files

📝 pkg/db/db.go (+25 -9)
📝 pkg/db/dump.go (+6 -9)
📝 pkg/files/db.go (+4 -0)
📝 pkg/models/models.go (+4 -0)
📝 pkg/modules/migration/db.go (+6 -0)
📝 pkg/notifications/db.go (+6 -0)
📝 pkg/user/db.go (+6 -0)

📄 Description

Summary

  • Adds a table registration mechanism to the db package so that Dump() and WipeEverything() only operate on known Vikunja tables
  • Each package (models, user, files, notifications, migration) registers its tables at init time via db.RegisterTables()
  • Replaces usage of x.DBMetas() (which discovers ALL tables in the database, including PostgreSQL extension tables) with the registered table list
  • This prevents dump/restore from failing when extensions like PostGIS add their own tables (e.g. spatial_ref_sys)

Closes go-vikunja/vikunja#2219

Test plan

  • All existing web tests pass (mage test:web)
  • All existing feature tests pass (mage test:feature)
  • Verify on a PostgreSQL database with PostGIS installed that dump and restore complete without errors

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2355 **Author:** [@tink-bot](https://github.com/tink-bot) **Created:** 3/4/2026 **Status:** ✅ Merged **Merged:** 3/4/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix-dump-extension-tables` --- ### 📝 Commits (5) - [`7273bc4`](https://github.com/go-vikunja/vikunja/commit/7273bc43096a3dbfe1220a78922cbbb0d008592b) feat: add table registration to db package - [`dde1668`](https://github.com/go-vikunja/vikunja/commit/dde16688cd84ea04cb2d6a93cab4e94b55c472dc) feat: register Vikunja tables with db package at init - [`a662cfd`](https://github.com/go-vikunja/vikunja/commit/a662cfdc95beff264218d183dd20dbf2fcf652c6) feat: add RegisteredTableNames helper to db package - [`65dfb30`](https://github.com/go-vikunja/vikunja/commit/65dfb306ccfeaa998aa71fb4a5b61b5c09057d16) fix: only drop Vikunja-owned tables in WipeEverything - [`68e3506`](https://github.com/go-vikunja/vikunja/commit/68e35067935c136d523ce787ed079b0c0415e8b6) fix: only dump Vikunja-owned tables ### 📊 Changes **7 files changed** (+57 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `pkg/db/db.go` (+25 -9) 📝 `pkg/db/dump.go` (+6 -9) 📝 `pkg/files/db.go` (+4 -0) 📝 `pkg/models/models.go` (+4 -0) 📝 `pkg/modules/migration/db.go` (+6 -0) 📝 `pkg/notifications/db.go` (+6 -0) 📝 `pkg/user/db.go` (+6 -0) </details> ### 📄 Description ## Summary - Adds a table registration mechanism to the `db` package so that `Dump()` and `WipeEverything()` only operate on known Vikunja tables - Each package (`models`, `user`, `files`, `notifications`, `migration`) registers its tables at init time via `db.RegisterTables()` - Replaces usage of `x.DBMetas()` (which discovers ALL tables in the database, including PostgreSQL extension tables) with the registered table list - This prevents dump/restore from failing when extensions like PostGIS add their own tables (e.g. `spatial_ref_sys`) Closes go-vikunja/vikunja#2219 ## Test plan - [x] All existing web tests pass (`mage test:web`) - [x] All existing feature tests pass (`mage test:feature`) - [ ] Verify on a PostgreSQL database with PostGIS installed that dump and restore complete without errors --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 09:17:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#9924