[PR #998] feat: add CLI command for importing and exporting Pocket ID data #510

Open
opened 2025-10-07 00:17:43 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/pocket-id/pocket-id/pull/998
Author: @stonith404
Created: 10/2/2025
Status: 🔄 Open

Base: mainHead: feat/data-export-import


📝 Commits (10+)

  • c822fea feat: add CLI command for importing and exporting Pocket ID data
  • 847c744 undo accidental connection string change
  • f333ff7 fix linter issue
  • 5995a33 return error early if pocket id version is too low
  • 32de502 fix error handling
  • 01225f0 Merge branch 'main' into feat/data-export-import
  • a47a017 enable triggers again for postgres
  • 34b29c6 prevent zip slip and fail early if file too large
  • dda6dc8 don't handle json specially
  • 9e764e6 don't encode html in json

📊 Changes

4 files changed (+623 additions, -12 deletions)

View changed files

📝 backend/internal/bootstrap/db_bootstrap.go (+18 -9)
backend/internal/cmds/export.go (+234 -0)
backend/internal/cmds/import.go (+367 -0)
📝 backend/internal/cmds/root.go (+4 -3)

📄 Description

This PR introduces two new commands (import and export) to the CLI. With these two commands all Pocket ID data, including the uploaded images, keys and database content can be exported to a ZIP file which then can be imported to a new instance. The limitations are that data can't be imported from an instance that uses another database provider or an instance that runs an older version than the exported data.


TODO:

  • Add some tests

Docker Image: ghcr.io/pocket-id/pocket-id:pr-998
Closes #721


🔄 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/pocket-id/pocket-id/pull/998 **Author:** [@stonith404](https://github.com/stonith404) **Created:** 10/2/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/data-export-import` --- ### 📝 Commits (10+) - [`c822fea`](https://github.com/pocket-id/pocket-id/commit/c822feaa115a98f627e401e2e870277b4003b2ef) feat: add CLI command for importing and exporting Pocket ID data - [`847c744`](https://github.com/pocket-id/pocket-id/commit/847c744cafe316e72d58afd9301caf3763fbc112) undo accidental connection string change - [`f333ff7`](https://github.com/pocket-id/pocket-id/commit/f333ff79692706aadc961ad548cdfad92a75ed65) fix linter issue - [`5995a33`](https://github.com/pocket-id/pocket-id/commit/5995a339a774d81846a035ddb11bd58de0b1a782) return error early if pocket id version is too low - [`32de502`](https://github.com/pocket-id/pocket-id/commit/32de502ae37d94481b42b9118d0a2155a03b3dc3) fix error handling - [`01225f0`](https://github.com/pocket-id/pocket-id/commit/01225f0b3e5ef857229949aad3a176fa9aeaa413) Merge branch 'main' into feat/data-export-import - [`a47a017`](https://github.com/pocket-id/pocket-id/commit/a47a017856200c9774449cbfd9ad517d6464abe9) enable triggers again for postgres - [`34b29c6`](https://github.com/pocket-id/pocket-id/commit/34b29c6f21bcda25d5e5fe85b5915c1fd9ca03f7) prevent zip slip and fail early if file too large - [`dda6dc8`](https://github.com/pocket-id/pocket-id/commit/dda6dc8cc0b52aa3ac95ad5bc4e2656d4009b6ea) don't handle json specially - [`9e764e6`](https://github.com/pocket-id/pocket-id/commit/9e764e6a39f21c632d1e904fad4e659238d852de) don't encode html in json ### 📊 Changes **4 files changed** (+623 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `backend/internal/bootstrap/db_bootstrap.go` (+18 -9) ➕ `backend/internal/cmds/export.go` (+234 -0) ➕ `backend/internal/cmds/import.go` (+367 -0) 📝 `backend/internal/cmds/root.go` (+4 -3) </details> ### 📄 Description This PR introduces two new commands (`import` and `export`) to the CLI. With these two commands all Pocket ID data, including the uploaded images, keys and database content can be exported to a ZIP file which then can be imported to a new instance. The limitations are that data can't be imported from an instance that uses another database provider or an instance that runs an older version than the exported data. --- TODO: - [ ] Add some tests ---- Docker Image: `ghcr.io/pocket-id/pocket-id:pr-998` Closes #721 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2025-10-07 00:17:44 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pocket-id#510