Documentation
¶
Overview ¶
Package importer copies the collections and the data of a PocketBase SQLite pb_data directory into a popgres (Postgres) app.
It is the only popgres package allowed to depend on a SQLite driver.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyStorage ¶
CopyStorage copies the local storage files of the PocketBase pb_data directory into the popgres data directory.
Types ¶
type Options ¶
type Options struct {
// SkipLogs skips the import of the auxiliary.db request logs.
SkipLogs bool
// Force allows importing into a database that already has non-system collections.
Force bool
}
Options defines the import options.
type Report ¶
type Report struct {
// Collections lists the names of the imported collections.
Collections []string
// Records holds the number of imported records per collection name.
Records map[string]int
// FailedViews holds the view collections that couldn't be created
// (usually because their query is not valid Postgres SQL) and their errors.
FailedViews map[string]error
// Params is the number of imported _params rows.
Params int
// Logs is the number of imported _logs rows.
Logs int
// FailedIndexes holds the collection indexes that couldn't be created in
// Postgres (eg. SQLite specific expressions) and were removed from the collections.
FailedIndexes map[string][]string
// FailedRules holds the collection API rules that fail to execute in
// Postgres (eg. comparisons of incompatible types) and need manual changes.
FailedRules map[string][]string
// APIOnlyRules holds the collection API rules that can't be translated
// to the Postgres RLS policies (they are still enforced by the API).
APIOnlyRules map[string][]string
// Storage describes where the records files are.
Storage string
}
Report describes the result of an import.
func Import ¶
Import copies the collections, records, settings and (optionally) the logs of the PocketBase pb_data directory into the provided bootstrapped popgres app.
The storage files are not copied (see CopyStorage).
func (*Report) HasManualChanges ¶
HasManualChanges reports whether the import found anything that needs manual changes.