spindb 0.37.2 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/bin.js +9 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/commands/attach.js +102 -0
- package/dist/cli/commands/attach.js.map +1 -0
- package/dist/cli/commands/backup.js +197 -0
- package/dist/cli/commands/backup.js.map +1 -0
- package/dist/cli/commands/backups.js +190 -0
- package/dist/cli/commands/backups.js.map +1 -0
- package/dist/cli/commands/clone.js +119 -0
- package/dist/cli/commands/clone.js.map +1 -0
- package/dist/cli/commands/config.js +276 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/connect.js +559 -0
- package/dist/cli/commands/connect.js.map +1 -0
- package/dist/cli/commands/create.js +952 -0
- package/dist/cli/commands/create.js.map +1 -0
- package/dist/cli/commands/databases.js +485 -0
- package/dist/cli/commands/databases.js.map +1 -0
- package/dist/cli/commands/delete.js +106 -0
- package/dist/cli/commands/delete.js.map +1 -0
- package/dist/cli/commands/deps.js +238 -0
- package/dist/cli/commands/deps.js.map +1 -0
- package/dist/cli/commands/detach.js +81 -0
- package/dist/cli/commands/detach.js.map +1 -0
- package/dist/cli/commands/doctor.js +567 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/duckdb.js +207 -0
- package/dist/cli/commands/duckdb.js.map +1 -0
- package/dist/cli/commands/edit.js +524 -0
- package/dist/cli/commands/edit.js.map +1 -0
- package/dist/cli/commands/engines.js +1414 -0
- package/dist/cli/commands/engines.js.map +1 -0
- package/dist/cli/commands/export.js +383 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/info.js +270 -0
- package/dist/cli/commands/info.js.map +1 -0
- package/dist/cli/commands/list.js +215 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/logs.js +81 -0
- package/dist/cli/commands/logs.js.map +1 -0
- package/dist/cli/commands/menu/backup-handlers.js +1202 -0
- package/dist/cli/commands/menu/backup-handlers.js.map +1 -0
- package/dist/cli/commands/menu/container-handlers.js +1788 -0
- package/dist/cli/commands/menu/container-handlers.js.map +1 -0
- package/dist/cli/commands/menu/engine-handlers.js +235 -0
- package/dist/cli/commands/menu/engine-handlers.js.map +1 -0
- package/dist/cli/commands/menu/index.js +266 -0
- package/dist/cli/commands/menu/index.js.map +1 -0
- package/dist/cli/commands/menu/settings-handlers.js +320 -0
- package/dist/cli/commands/menu/settings-handlers.js.map +1 -0
- package/dist/cli/commands/menu/shared.js +13 -0
- package/dist/cli/commands/menu/shared.js.map +1 -0
- package/dist/cli/commands/menu/shell-handlers.js +1573 -0
- package/dist/cli/commands/menu/shell-handlers.js.map +1 -0
- package/dist/cli/commands/menu/sql-handlers.js +185 -0
- package/dist/cli/commands/menu/sql-handlers.js.map +1 -0
- package/dist/cli/commands/menu/update-handlers.js +322 -0
- package/dist/cli/commands/menu/update-handlers.js.map +1 -0
- package/dist/cli/commands/menu/validators.js +9 -0
- package/dist/cli/commands/menu/validators.js.map +1 -0
- package/dist/cli/commands/ports.js +166 -0
- package/dist/cli/commands/ports.js.map +1 -0
- package/dist/cli/commands/pull.js +166 -0
- package/dist/cli/commands/pull.js.map +1 -0
- package/dist/cli/commands/query.js +180 -0
- package/dist/cli/commands/query.js.map +1 -0
- package/dist/cli/commands/restore.js +428 -0
- package/dist/cli/commands/restore.js.map +1 -0
- package/dist/cli/commands/run.js +115 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/self-update.js +99 -0
- package/dist/cli/commands/self-update.js.map +1 -0
- package/dist/cli/commands/sqlite.js +207 -0
- package/dist/cli/commands/sqlite.js.map +1 -0
- package/dist/cli/commands/start.js +196 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/stop.js +182 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/commands/url.js +88 -0
- package/dist/cli/commands/url.js.map +1 -0
- package/dist/cli/commands/users.js +189 -0
- package/dist/cli/commands/users.js.map +1 -0
- package/dist/cli/commands/version.js +52 -0
- package/dist/cli/commands/version.js.map +1 -0
- package/dist/cli/commands/which.js +258 -0
- package/dist/cli/commands/which.js.map +1 -0
- package/dist/cli/constants.js +212 -0
- package/dist/cli/constants.js.map +1 -0
- package/dist/cli/helpers.js +1120 -0
- package/dist/cli/helpers.js.map +1 -0
- package/dist/cli/index.js +146 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/ui/prompts.js +1002 -0
- package/dist/cli/ui/prompts.js.map +1 -0
- package/dist/cli/ui/spinner.js +74 -0
- package/dist/cli/ui/spinner.js.map +1 -0
- package/dist/cli/ui/theme.js +99 -0
- package/dist/cli/ui/theme.js.map +1 -0
- package/dist/cli/utils/file-follower.js +79 -0
- package/dist/cli/utils/file-follower.js.map +1 -0
- package/dist/config/backup-formats.js +363 -0
- package/dist/config/backup-formats.js.map +1 -0
- package/dist/config/defaults.js +25 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/engine-defaults.js +303 -0
- package/dist/config/engine-defaults.js.map +1 -0
- package/dist/config/engines-registry.js +103 -0
- package/dist/config/engines-registry.js.map +1 -0
- package/dist/config/os-dependencies.js +767 -0
- package/dist/config/os-dependencies.js.map +1 -0
- package/dist/config/paths.js +156 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/version.js +3 -0
- package/dist/config/version.js.map +1 -0
- package/dist/core/backup-restore.js +219 -0
- package/dist/core/backup-restore.js.map +1 -0
- package/dist/core/base-binary-manager.js +403 -0
- package/dist/core/base-binary-manager.js.map +1 -0
- package/dist/core/base-document-binary-manager.js +364 -0
- package/dist/core/base-document-binary-manager.js.map +1 -0
- package/dist/core/base-embedded-binary-manager.js +364 -0
- package/dist/core/base-embedded-binary-manager.js.map +1 -0
- package/dist/core/base-server-binary-manager.js +368 -0
- package/dist/core/base-server-binary-manager.js.map +1 -0
- package/dist/core/config-manager.js +495 -0
- package/dist/core/config-manager.js.map +1 -0
- package/dist/core/container-manager.js +609 -0
- package/dist/core/container-manager.js.map +1 -0
- package/dist/core/credential-generator.js +67 -0
- package/dist/core/credential-generator.js.map +1 -0
- package/dist/core/credential-manager.js +211 -0
- package/dist/core/credential-manager.js.map +1 -0
- package/dist/core/dblab-utils.js +105 -0
- package/dist/core/dblab-utils.js.map +1 -0
- package/dist/core/dependency-manager.js +359 -0
- package/dist/core/dependency-manager.js.map +1 -0
- package/dist/core/docker-exporter.js +1077 -0
- package/dist/core/docker-exporter.js.map +1 -0
- package/dist/core/error-handler.js +295 -0
- package/dist/core/error-handler.js.map +1 -0
- package/dist/core/fs-error-utils.js +74 -0
- package/dist/core/fs-error-utils.js.map +1 -0
- package/dist/core/homebrew-version-manager.js +280 -0
- package/dist/core/homebrew-version-manager.js.map +1 -0
- package/dist/core/hostdb-client.js +252 -0
- package/dist/core/hostdb-client.js.map +1 -0
- package/dist/core/hostdb-metadata.js +243 -0
- package/dist/core/hostdb-metadata.js.map +1 -0
- package/dist/core/hostdb-releases-factory.js +161 -0
- package/dist/core/hostdb-releases-factory.js.map +1 -0
- package/dist/core/library-env.js +88 -0
- package/dist/core/library-env.js.map +1 -0
- package/dist/core/pgweb-utils.js +53 -0
- package/dist/core/pgweb-utils.js.map +1 -0
- package/dist/core/platform-service.js +632 -0
- package/dist/core/platform-service.js.map +1 -0
- package/dist/core/port-manager.js +136 -0
- package/dist/core/port-manager.js.map +1 -0
- package/dist/core/process-manager.js +445 -0
- package/dist/core/process-manager.js.map +1 -0
- package/dist/core/pull-manager.js +418 -0
- package/dist/core/pull-manager.js.map +1 -0
- package/dist/core/query-parser.js +449 -0
- package/dist/core/query-parser.js.map +1 -0
- package/dist/core/spawn-utils.js +90 -0
- package/dist/core/spawn-utils.js.map +1 -0
- package/dist/core/start-with-retry.js +90 -0
- package/dist/core/start-with-retry.js.map +1 -0
- package/dist/core/test-cleanup.js +85 -0
- package/dist/core/test-cleanup.js.map +1 -0
- package/dist/core/tls-generator.js +84 -0
- package/dist/core/tls-generator.js.map +1 -0
- package/dist/core/transaction-manager.js +139 -0
- package/dist/core/transaction-manager.js.map +1 -0
- package/dist/core/update-manager.js +241 -0
- package/dist/core/update-manager.js.map +1 -0
- package/dist/core/version-migration.js +260 -0
- package/dist/core/version-migration.js.map +1 -0
- package/dist/core/version-utils.js +91 -0
- package/dist/core/version-utils.js.map +1 -0
- package/dist/engines/base-engine.js +179 -0
- package/dist/engines/base-engine.js.map +1 -0
- package/dist/engines/clickhouse/backup.js +289 -0
- package/dist/engines/clickhouse/backup.js.map +1 -0
- package/dist/engines/clickhouse/binary-manager.js +145 -0
- package/dist/engines/clickhouse/binary-manager.js.map +1 -0
- package/dist/engines/clickhouse/binary-urls.js +100 -0
- package/dist/engines/clickhouse/binary-urls.js.map +1 -0
- package/dist/engines/clickhouse/cli-utils.js +143 -0
- package/dist/engines/clickhouse/cli-utils.js.map +1 -0
- package/dist/engines/clickhouse/hostdb-releases.js +24 -0
- package/dist/engines/clickhouse/hostdb-releases.js.map +1 -0
- package/dist/engines/clickhouse/index.js +1077 -0
- package/dist/engines/clickhouse/index.js.map +1 -0
- package/dist/engines/clickhouse/restore.js +335 -0
- package/dist/engines/clickhouse/restore.js.map +1 -0
- package/dist/engines/clickhouse/version-maps.js +83 -0
- package/dist/engines/clickhouse/version-maps.js.map +1 -0
- package/dist/engines/clickhouse/version-validator.js +133 -0
- package/dist/engines/clickhouse/version-validator.js.map +1 -0
- package/dist/engines/cockroachdb/backup.js +261 -0
- package/dist/engines/cockroachdb/backup.js.map +1 -0
- package/dist/engines/cockroachdb/binary-manager.js +33 -0
- package/dist/engines/cockroachdb/binary-manager.js.map +1 -0
- package/dist/engines/cockroachdb/binary-urls.js +33 -0
- package/dist/engines/cockroachdb/binary-urls.js.map +1 -0
- package/dist/engines/cockroachdb/cli-utils.js +338 -0
- package/dist/engines/cockroachdb/cli-utils.js.map +1 -0
- package/dist/engines/cockroachdb/hostdb-releases.js +21 -0
- package/dist/engines/cockroachdb/hostdb-releases.js.map +1 -0
- package/dist/engines/cockroachdb/index.js +1016 -0
- package/dist/engines/cockroachdb/index.js.map +1 -0
- package/dist/engines/cockroachdb/restore.js +323 -0
- package/dist/engines/cockroachdb/restore.js.map +1 -0
- package/dist/engines/cockroachdb/version-maps.js +37 -0
- package/dist/engines/cockroachdb/version-maps.js.map +1 -0
- package/dist/engines/couchdb/api-client.js +64 -0
- package/dist/engines/couchdb/api-client.js.map +1 -0
- package/dist/engines/couchdb/backup.js +90 -0
- package/dist/engines/couchdb/backup.js.map +1 -0
- package/dist/engines/couchdb/binary-manager.js +62 -0
- package/dist/engines/couchdb/binary-manager.js.map +1 -0
- package/dist/engines/couchdb/binary-urls.js +92 -0
- package/dist/engines/couchdb/binary-urls.js.map +1 -0
- package/dist/engines/couchdb/hostdb-releases.js +21 -0
- package/dist/engines/couchdb/hostdb-releases.js.map +1 -0
- package/dist/engines/couchdb/index.js +1043 -0
- package/dist/engines/couchdb/index.js.map +1 -0
- package/dist/engines/couchdb/restore.js +198 -0
- package/dist/engines/couchdb/restore.js.map +1 -0
- package/dist/engines/couchdb/version-maps.js +67 -0
- package/dist/engines/couchdb/version-maps.js.map +1 -0
- package/dist/engines/couchdb/version-validator.js +88 -0
- package/dist/engines/couchdb/version-validator.js.map +1 -0
- package/dist/engines/duckdb/binary-manager.js +33 -0
- package/dist/engines/duckdb/binary-manager.js.map +1 -0
- package/{engines/duckdb/binary-urls.ts → dist/engines/duckdb/binary-urls.js} +11 -16
- package/dist/engines/duckdb/binary-urls.js.map +1 -0
- package/dist/engines/duckdb/hostdb-releases.js +21 -0
- package/dist/engines/duckdb/hostdb-releases.js.map +1 -0
- package/dist/engines/duckdb/index.js +594 -0
- package/dist/engines/duckdb/index.js.map +1 -0
- package/dist/engines/duckdb/registry.js +265 -0
- package/dist/engines/duckdb/registry.js.map +1 -0
- package/dist/engines/duckdb/scanner.js +12 -0
- package/dist/engines/duckdb/scanner.js.map +1 -0
- package/dist/engines/duckdb/version-maps.js +67 -0
- package/dist/engines/duckdb/version-maps.js.map +1 -0
- package/dist/engines/duckdb/version-validator.js +62 -0
- package/dist/engines/duckdb/version-validator.js.map +1 -0
- package/dist/engines/ferretdb/backup.js +170 -0
- package/dist/engines/ferretdb/backup.js.map +1 -0
- package/dist/engines/ferretdb/binary-manager.js +765 -0
- package/dist/engines/ferretdb/binary-manager.js.map +1 -0
- package/dist/engines/ferretdb/binary-urls.js +135 -0
- package/dist/engines/ferretdb/binary-urls.js.map +1 -0
- package/dist/engines/ferretdb/index.js +1517 -0
- package/dist/engines/ferretdb/index.js.map +1 -0
- package/dist/engines/ferretdb/restore.js +310 -0
- package/dist/engines/ferretdb/restore.js.map +1 -0
- package/{engines/ferretdb/version-maps.ts → dist/engines/ferretdb/version-maps.js} +62 -79
- package/dist/engines/ferretdb/version-maps.js.map +1 -0
- package/dist/engines/file-based-utils.js +184 -0
- package/dist/engines/file-based-utils.js.map +1 -0
- package/dist/engines/index.js +124 -0
- package/dist/engines/index.js.map +1 -0
- package/dist/engines/influxdb/api-client.js +54 -0
- package/dist/engines/influxdb/api-client.js.map +1 -0
- package/dist/engines/influxdb/backup.js +119 -0
- package/dist/engines/influxdb/backup.js.map +1 -0
- package/dist/engines/influxdb/binary-manager.js +87 -0
- package/dist/engines/influxdb/binary-manager.js.map +1 -0
- package/dist/engines/influxdb/binary-urls.js +56 -0
- package/dist/engines/influxdb/binary-urls.js.map +1 -0
- package/dist/engines/influxdb/hostdb-releases.js +21 -0
- package/dist/engines/influxdb/hostdb-releases.js.map +1 -0
- package/dist/engines/influxdb/index.js +962 -0
- package/dist/engines/influxdb/index.js.map +1 -0
- package/dist/engines/influxdb/restore.js +329 -0
- package/dist/engines/influxdb/restore.js.map +1 -0
- package/dist/engines/influxdb/version-maps.js +64 -0
- package/dist/engines/influxdb/version-maps.js.map +1 -0
- package/dist/engines/influxdb/version-validator.js +109 -0
- package/dist/engines/influxdb/version-validator.js.map +1 -0
- package/dist/engines/mariadb/backup.js +178 -0
- package/dist/engines/mariadb/backup.js.map +1 -0
- package/dist/engines/mariadb/binary-manager.js +33 -0
- package/dist/engines/mariadb/binary-manager.js.map +1 -0
- package/{engines/mariadb/binary-urls.ts → dist/engines/mariadb/binary-urls.js} +38 -55
- package/dist/engines/mariadb/binary-urls.js.map +1 -0
- package/dist/engines/mariadb/hostdb-releases.js +21 -0
- package/dist/engines/mariadb/hostdb-releases.js.map +1 -0
- package/dist/engines/mariadb/index.js +1011 -0
- package/dist/engines/mariadb/index.js.map +1 -0
- package/dist/engines/mariadb/restore.js +322 -0
- package/dist/engines/mariadb/restore.js.map +1 -0
- package/dist/engines/mariadb/version-maps.js +63 -0
- package/dist/engines/mariadb/version-maps.js.map +1 -0
- package/dist/engines/mariadb/version-validator.js +143 -0
- package/dist/engines/mariadb/version-validator.js.map +1 -0
- package/dist/engines/meilisearch/api-client.js +50 -0
- package/dist/engines/meilisearch/api-client.js.map +1 -0
- package/dist/engines/meilisearch/backup.js +167 -0
- package/dist/engines/meilisearch/backup.js.map +1 -0
- package/dist/engines/meilisearch/binary-manager.js +31 -0
- package/dist/engines/meilisearch/binary-manager.js.map +1 -0
- package/dist/engines/meilisearch/binary-urls.js +56 -0
- package/dist/engines/meilisearch/binary-urls.js.map +1 -0
- package/dist/engines/meilisearch/hostdb-releases.js +21 -0
- package/dist/engines/meilisearch/hostdb-releases.js.map +1 -0
- package/dist/engines/meilisearch/index.js +992 -0
- package/dist/engines/meilisearch/index.js.map +1 -0
- package/dist/engines/meilisearch/restore.js +167 -0
- package/dist/engines/meilisearch/restore.js.map +1 -0
- package/dist/engines/meilisearch/version-maps.js +67 -0
- package/dist/engines/meilisearch/version-maps.js.map +1 -0
- package/dist/engines/meilisearch/version-validator.js +109 -0
- package/dist/engines/meilisearch/version-validator.js.map +1 -0
- package/dist/engines/mongodb/backup.js +109 -0
- package/dist/engines/mongodb/backup.js.map +1 -0
- package/dist/engines/mongodb/binary-manager.js +36 -0
- package/dist/engines/mongodb/binary-manager.js.map +1 -0
- package/dist/engines/mongodb/binary-urls.js +46 -0
- package/dist/engines/mongodb/binary-urls.js.map +1 -0
- package/dist/engines/mongodb/cli-utils.js +131 -0
- package/dist/engines/mongodb/cli-utils.js.map +1 -0
- package/dist/engines/mongodb/hostdb-releases.js +77 -0
- package/dist/engines/mongodb/hostdb-releases.js.map +1 -0
- package/dist/engines/mongodb/index.js +873 -0
- package/dist/engines/mongodb/index.js.map +1 -0
- package/dist/engines/mongodb/restore.js +276 -0
- package/dist/engines/mongodb/restore.js.map +1 -0
- package/dist/engines/mongodb/version-maps.js +79 -0
- package/dist/engines/mongodb/version-maps.js.map +1 -0
- package/dist/engines/mongodb/version-validator.js +133 -0
- package/dist/engines/mongodb/version-validator.js.map +1 -0
- package/dist/engines/mysql/backup.js +210 -0
- package/dist/engines/mysql/backup.js.map +1 -0
- package/dist/engines/mysql/binary-detection.js +325 -0
- package/dist/engines/mysql/binary-detection.js.map +1 -0
- package/dist/engines/mysql/binary-manager.js +30 -0
- package/dist/engines/mysql/binary-manager.js.map +1 -0
- package/dist/engines/mysql/binary-urls.js +87 -0
- package/dist/engines/mysql/binary-urls.js.map +1 -0
- package/{engines/mysql/hostdb-releases.ts → dist/engines/mysql/hostdb-releases.js} +20 -23
- package/dist/engines/mysql/hostdb-releases.js.map +1 -0
- package/dist/engines/mysql/index.js +1066 -0
- package/dist/engines/mysql/index.js.map +1 -0
- package/dist/engines/mysql/restore.js +361 -0
- package/dist/engines/mysql/restore.js.map +1 -0
- package/dist/engines/mysql/version-maps.js +79 -0
- package/dist/engines/mysql/version-maps.js.map +1 -0
- package/dist/engines/mysql/version-validator.js +266 -0
- package/dist/engines/mysql/version-validator.js.map +1 -0
- package/dist/engines/postgresql/backup.js +118 -0
- package/dist/engines/postgresql/backup.js.map +1 -0
- package/dist/engines/postgresql/binary-manager.js +85 -0
- package/dist/engines/postgresql/binary-manager.js.map +1 -0
- package/dist/engines/postgresql/binary-urls.js +80 -0
- package/dist/engines/postgresql/binary-urls.js.map +1 -0
- package/dist/engines/postgresql/hostdb-releases.js +21 -0
- package/dist/engines/postgresql/hostdb-releases.js.map +1 -0
- package/dist/engines/postgresql/index.js +852 -0
- package/dist/engines/postgresql/index.js.map +1 -0
- package/dist/engines/postgresql/remote-version.js +109 -0
- package/dist/engines/postgresql/remote-version.js.map +1 -0
- package/dist/engines/postgresql/restore.js +254 -0
- package/dist/engines/postgresql/restore.js.map +1 -0
- package/dist/engines/postgresql/version-maps.js +73 -0
- package/dist/engines/postgresql/version-maps.js.map +1 -0
- package/dist/engines/postgresql/version-validator.js +286 -0
- package/dist/engines/postgresql/version-validator.js.map +1 -0
- package/dist/engines/qdrant/api-client.js +50 -0
- package/dist/engines/qdrant/api-client.js.map +1 -0
- package/dist/engines/qdrant/backup.js +115 -0
- package/dist/engines/qdrant/backup.js.map +1 -0
- package/dist/engines/qdrant/binary-manager.js +31 -0
- package/dist/engines/qdrant/binary-manager.js.map +1 -0
- package/dist/engines/qdrant/binary-urls.js +92 -0
- package/dist/engines/qdrant/binary-urls.js.map +1 -0
- package/dist/engines/qdrant/cli-utils.js +39 -0
- package/dist/engines/qdrant/cli-utils.js.map +1 -0
- package/dist/engines/qdrant/hostdb-releases.js +21 -0
- package/dist/engines/qdrant/hostdb-releases.js.map +1 -0
- package/dist/engines/qdrant/index.js +1002 -0
- package/dist/engines/qdrant/index.js.map +1 -0
- package/dist/engines/qdrant/restore.js +154 -0
- package/dist/engines/qdrant/restore.js.map +1 -0
- package/dist/engines/qdrant/version-maps.js +67 -0
- package/dist/engines/qdrant/version-maps.js.map +1 -0
- package/dist/engines/qdrant/version-validator.js +109 -0
- package/dist/engines/qdrant/version-validator.js.map +1 -0
- package/dist/engines/questdb/backup.js +191 -0
- package/dist/engines/questdb/backup.js.map +1 -0
- package/dist/engines/questdb/binary-manager.js +247 -0
- package/dist/engines/questdb/binary-manager.js.map +1 -0
- package/dist/engines/questdb/binary-urls.js +27 -0
- package/dist/engines/questdb/binary-urls.js.map +1 -0
- package/dist/engines/questdb/hostdb-releases.js +21 -0
- package/dist/engines/questdb/hostdb-releases.js.map +1 -0
- package/dist/engines/questdb/index.js +814 -0
- package/dist/engines/questdb/index.js.map +1 -0
- package/dist/engines/questdb/restore.js +202 -0
- package/dist/engines/questdb/restore.js.map +1 -0
- package/dist/engines/questdb/version-maps.js +33 -0
- package/dist/engines/questdb/version-maps.js.map +1 -0
- package/dist/engines/questdb/version-validator.js +99 -0
- package/dist/engines/questdb/version-validator.js.map +1 -0
- package/dist/engines/redis/backup.js +292 -0
- package/dist/engines/redis/backup.js.map +1 -0
- package/dist/engines/redis/binary-manager.js +32 -0
- package/dist/engines/redis/binary-manager.js.map +1 -0
- package/dist/engines/redis/binary-urls.js +96 -0
- package/dist/engines/redis/binary-urls.js.map +1 -0
- package/dist/engines/redis/cli-utils.js +38 -0
- package/dist/engines/redis/cli-utils.js.map +1 -0
- package/dist/engines/redis/hostdb-releases.js +21 -0
- package/dist/engines/redis/hostdb-releases.js.map +1 -0
- package/dist/engines/redis/index.js +1263 -0
- package/dist/engines/redis/index.js.map +1 -0
- package/dist/engines/redis/restore.js +338 -0
- package/dist/engines/redis/restore.js.map +1 -0
- package/dist/engines/redis/version-maps.js +70 -0
- package/dist/engines/redis/version-maps.js.map +1 -0
- package/dist/engines/redis/version-validator.js +109 -0
- package/dist/engines/redis/version-validator.js.map +1 -0
- package/dist/engines/sqlite/binary-manager.js +39 -0
- package/dist/engines/sqlite/binary-manager.js.map +1 -0
- package/{engines/sqlite/binary-urls.ts → dist/engines/sqlite/binary-urls.js} +11 -16
- package/dist/engines/sqlite/binary-urls.js.map +1 -0
- package/dist/engines/sqlite/hostdb-releases.js +21 -0
- package/dist/engines/sqlite/hostdb-releases.js.map +1 -0
- package/dist/engines/sqlite/index.js +493 -0
- package/dist/engines/sqlite/index.js.map +1 -0
- package/dist/engines/sqlite/registry.js +163 -0
- package/dist/engines/sqlite/registry.js.map +1 -0
- package/dist/engines/sqlite/scanner.js +12 -0
- package/dist/engines/sqlite/scanner.js.map +1 -0
- package/dist/engines/sqlite/version-maps.js +57 -0
- package/dist/engines/sqlite/version-maps.js.map +1 -0
- package/dist/engines/surrealdb/backup.js +97 -0
- package/dist/engines/surrealdb/backup.js.map +1 -0
- package/dist/engines/surrealdb/binary-manager.js +33 -0
- package/dist/engines/surrealdb/binary-manager.js.map +1 -0
- package/dist/engines/surrealdb/binary-urls.js +33 -0
- package/dist/engines/surrealdb/binary-urls.js.map +1 -0
- package/dist/engines/surrealdb/cli-utils.js +147 -0
- package/dist/engines/surrealdb/cli-utils.js.map +1 -0
- package/dist/engines/surrealdb/hostdb-releases.js +21 -0
- package/dist/engines/surrealdb/hostdb-releases.js.map +1 -0
- package/dist/engines/surrealdb/index.js +1022 -0
- package/dist/engines/surrealdb/index.js.map +1 -0
- package/dist/engines/surrealdb/restore.js +224 -0
- package/dist/engines/surrealdb/restore.js.map +1 -0
- package/dist/engines/surrealdb/version-maps.js +36 -0
- package/dist/engines/surrealdb/version-maps.js.map +1 -0
- package/dist/engines/tigerbeetle/backup.js +36 -0
- package/dist/engines/tigerbeetle/backup.js.map +1 -0
- package/dist/engines/tigerbeetle/binary-manager.js +72 -0
- package/dist/engines/tigerbeetle/binary-manager.js.map +1 -0
- package/dist/engines/tigerbeetle/binary-urls.js +49 -0
- package/dist/engines/tigerbeetle/binary-urls.js.map +1 -0
- package/dist/engines/tigerbeetle/hostdb-releases.js +21 -0
- package/dist/engines/tigerbeetle/hostdb-releases.js.map +1 -0
- package/dist/engines/tigerbeetle/index.js +559 -0
- package/dist/engines/tigerbeetle/index.js.map +1 -0
- package/dist/engines/tigerbeetle/restore.js +91 -0
- package/dist/engines/tigerbeetle/restore.js.map +1 -0
- package/{engines/tigerbeetle/version-maps.ts → dist/engines/tigerbeetle/version-maps.js} +22 -31
- package/dist/engines/tigerbeetle/version-maps.js.map +1 -0
- package/dist/engines/tigerbeetle/version-validator.js +108 -0
- package/dist/engines/tigerbeetle/version-validator.js.map +1 -0
- package/dist/engines/typedb/backup.js +129 -0
- package/dist/engines/typedb/backup.js.map +1 -0
- package/dist/engines/typedb/binary-manager.js +151 -0
- package/dist/engines/typedb/binary-manager.js.map +1 -0
- package/dist/engines/typedb/binary-urls.js +33 -0
- package/dist/engines/typedb/binary-urls.js.map +1 -0
- package/dist/engines/typedb/cli-utils.js +163 -0
- package/dist/engines/typedb/cli-utils.js.map +1 -0
- package/dist/engines/typedb/hostdb-releases.js +21 -0
- package/dist/engines/typedb/hostdb-releases.js.map +1 -0
- package/dist/engines/typedb/index.js +1003 -0
- package/dist/engines/typedb/index.js.map +1 -0
- package/dist/engines/typedb/restore.js +279 -0
- package/dist/engines/typedb/restore.js.map +1 -0
- package/dist/engines/typedb/version-maps.js +40 -0
- package/dist/engines/typedb/version-maps.js.map +1 -0
- package/dist/engines/typedb/version-validator.js +103 -0
- package/dist/engines/typedb/version-validator.js.map +1 -0
- package/dist/engines/valkey/backup.js +292 -0
- package/dist/engines/valkey/backup.js.map +1 -0
- package/dist/engines/valkey/binary-manager.js +33 -0
- package/dist/engines/valkey/binary-manager.js.map +1 -0
- package/dist/engines/valkey/binary-urls.js +98 -0
- package/dist/engines/valkey/binary-urls.js.map +1 -0
- package/dist/engines/valkey/cli-utils.js +38 -0
- package/dist/engines/valkey/cli-utils.js.map +1 -0
- package/dist/engines/valkey/hostdb-releases.js +21 -0
- package/dist/engines/valkey/hostdb-releases.js.map +1 -0
- package/dist/engines/valkey/index.js +1257 -0
- package/dist/engines/valkey/index.js.map +1 -0
- package/dist/engines/valkey/restore.js +340 -0
- package/dist/engines/valkey/restore.js.map +1 -0
- package/dist/engines/valkey/version-maps.js +70 -0
- package/dist/engines/valkey/version-maps.js.map +1 -0
- package/dist/engines/valkey/version-validator.js +112 -0
- package/dist/engines/valkey/version-validator.js.map +1 -0
- package/dist/engines/weaviate/api-client.js +50 -0
- package/dist/engines/weaviate/api-client.js.map +1 -0
- package/dist/engines/weaviate/backup.js +95 -0
- package/dist/engines/weaviate/backup.js.map +1 -0
- package/dist/engines/weaviate/binary-manager.js +58 -0
- package/dist/engines/weaviate/binary-manager.js.map +1 -0
- package/dist/engines/weaviate/binary-urls.js +92 -0
- package/dist/engines/weaviate/binary-urls.js.map +1 -0
- package/dist/engines/weaviate/cli-utils.js +39 -0
- package/dist/engines/weaviate/cli-utils.js.map +1 -0
- package/dist/engines/weaviate/hostdb-releases.js +21 -0
- package/dist/engines/weaviate/hostdb-releases.js.map +1 -0
- package/dist/engines/weaviate/index.js +871 -0
- package/dist/engines/weaviate/index.js.map +1 -0
- package/dist/engines/weaviate/restore.js +185 -0
- package/dist/engines/weaviate/restore.js.map +1 -0
- package/dist/engines/weaviate/version-maps.js +67 -0
- package/dist/engines/weaviate/version-maps.js.map +1 -0
- package/dist/engines/weaviate/version-validator.js +109 -0
- package/dist/engines/weaviate/version-validator.js.map +1 -0
- package/dist/types/index.js +102 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +12 -9
- package/bin/cli.js +0 -68
- package/cli/bin.ts +0 -10
- package/cli/commands/attach.ts +0 -139
- package/cli/commands/backup.ts +0 -290
- package/cli/commands/backups.ts +0 -247
- package/cli/commands/clone.ts +0 -159
- package/cli/commands/config.ts +0 -367
- package/cli/commands/connect.ts +0 -684
- package/cli/commands/create.ts +0 -1201
- package/cli/commands/databases.ts +0 -630
- package/cli/commands/delete.ts +0 -133
- package/cli/commands/deps.ts +0 -342
- package/cli/commands/detach.ts +0 -107
- package/cli/commands/doctor.ts +0 -689
- package/cli/commands/duckdb.ts +0 -273
- package/cli/commands/edit.ts +0 -683
- package/cli/commands/engines.ts +0 -1914
- package/cli/commands/export.ts +0 -544
- package/cli/commands/info.ts +0 -340
- package/cli/commands/list.ts +0 -284
- package/cli/commands/logs.ts +0 -102
- package/cli/commands/menu/backup-handlers.ts +0 -1571
- package/cli/commands/menu/container-handlers.ts +0 -2288
- package/cli/commands/menu/engine-handlers.ts +0 -355
- package/cli/commands/menu/index.ts +0 -342
- package/cli/commands/menu/settings-handlers.ts +0 -365
- package/cli/commands/menu/shared.ts +0 -23
- package/cli/commands/menu/shell-handlers.ts +0 -1811
- package/cli/commands/menu/sql-handlers.ts +0 -231
- package/cli/commands/menu/update-handlers.ts +0 -378
- package/cli/commands/menu/validators.ts +0 -8
- package/cli/commands/ports.ts +0 -211
- package/cli/commands/pull.ts +0 -223
- package/cli/commands/query.ts +0 -241
- package/cli/commands/restore.ts +0 -587
- package/cli/commands/run.ts +0 -178
- package/cli/commands/self-update.ts +0 -121
- package/cli/commands/sqlite.ts +0 -273
- package/cli/commands/start.ts +0 -218
- package/cli/commands/stop.ts +0 -241
- package/cli/commands/url.ts +0 -104
- package/cli/commands/users.ts +0 -264
- package/cli/commands/version.ts +0 -55
- package/cli/commands/which.ts +0 -290
- package/cli/constants.ts +0 -233
- package/cli/helpers.ts +0 -1593
- package/cli/index.ts +0 -162
- package/cli/ui/prompts.ts +0 -1525
- package/cli/ui/spinner.ts +0 -88
- package/cli/ui/theme.ts +0 -128
- package/cli/utils/file-follower.ts +0 -93
- package/config/backup-formats.ts +0 -446
- package/config/defaults.ts +0 -56
- package/config/engine-defaults.ts +0 -336
- package/config/engines-registry.ts +0 -150
- package/config/engines.schema.json +0 -135
- package/config/os-dependencies.ts +0 -888
- package/config/paths.ts +0 -200
- package/core/backup-restore.ts +0 -330
- package/core/base-binary-manager.ts +0 -562
- package/core/base-document-binary-manager.ts +0 -523
- package/core/base-embedded-binary-manager.ts +0 -547
- package/core/base-server-binary-manager.ts +0 -523
- package/core/config-manager.ts +0 -652
- package/core/container-manager.ts +0 -787
- package/core/credential-generator.ts +0 -93
- package/core/credential-manager.ts +0 -259
- package/core/dblab-utils.ts +0 -113
- package/core/dependency-manager.ts +0 -512
- package/core/docker-exporter.ts +0 -1345
- package/core/error-handler.ts +0 -419
- package/core/fs-error-utils.ts +0 -82
- package/core/homebrew-version-manager.ts +0 -352
- package/core/hostdb-client.ts +0 -344
- package/core/hostdb-metadata.ts +0 -350
- package/core/hostdb-releases-factory.ts +0 -237
- package/core/library-env.ts +0 -118
- package/core/pgweb-utils.ts +0 -62
- package/core/platform-service.ts +0 -829
- package/core/port-manager.ts +0 -165
- package/core/process-manager.ts +0 -576
- package/core/pull-manager.ts +0 -511
- package/core/query-parser.ts +0 -514
- package/core/spawn-utils.ts +0 -122
- package/core/start-with-retry.ts +0 -130
- package/core/test-cleanup.ts +0 -108
- package/core/tls-generator.ts +0 -116
- package/core/transaction-manager.ts +0 -158
- package/core/update-manager.ts +0 -308
- package/core/version-migration.ts +0 -346
- package/core/version-utils.ts +0 -104
- package/engines/base-engine.ts +0 -340
- package/engines/clickhouse/README.md +0 -231
- package/engines/clickhouse/backup.ts +0 -398
- package/engines/clickhouse/binary-manager.ts +0 -201
- package/engines/clickhouse/binary-urls.ts +0 -125
- package/engines/clickhouse/cli-utils.ts +0 -176
- package/engines/clickhouse/hostdb-releases.ts +0 -30
- package/engines/clickhouse/index.ts +0 -1345
- package/engines/clickhouse/restore.ts +0 -466
- package/engines/clickhouse/version-maps.ts +0 -95
- package/engines/clickhouse/version-validator.ts +0 -154
- package/engines/cockroachdb/README.md +0 -170
- package/engines/cockroachdb/backup.ts +0 -376
- package/engines/cockroachdb/binary-manager.ts +0 -45
- package/engines/cockroachdb/binary-urls.ts +0 -40
- package/engines/cockroachdb/cli-utils.ts +0 -384
- package/engines/cockroachdb/hostdb-releases.ts +0 -26
- package/engines/cockroachdb/index.ts +0 -1276
- package/engines/cockroachdb/restore.ts +0 -455
- package/engines/cockroachdb/version-maps.ts +0 -42
- package/engines/couchdb/README.md +0 -257
- package/engines/couchdb/api-client.ts +0 -81
- package/engines/couchdb/backup.ts +0 -137
- package/engines/couchdb/binary-manager.ts +0 -86
- package/engines/couchdb/binary-urls.ts +0 -115
- package/engines/couchdb/hostdb-releases.ts +0 -23
- package/engines/couchdb/index.ts +0 -1429
- package/engines/couchdb/restore.ts +0 -290
- package/engines/couchdb/version-maps.ts +0 -78
- package/engines/couchdb/version-validator.ts +0 -111
- package/engines/duckdb/README.md +0 -154
- package/engines/duckdb/binary-manager.ts +0 -45
- package/engines/duckdb/hostdb-releases.ts +0 -23
- package/engines/duckdb/index.ts +0 -749
- package/engines/duckdb/registry.ts +0 -303
- package/engines/duckdb/scanner.ts +0 -22
- package/engines/duckdb/version-maps.ts +0 -78
- package/engines/duckdb/version-validator.ts +0 -78
- package/engines/ferretdb/README.md +0 -262
- package/engines/ferretdb/backup.ts +0 -173
- package/engines/ferretdb/binary-manager.ts +0 -1095
- package/engines/ferretdb/binary-urls.ts +0 -183
- package/engines/ferretdb/index.ts +0 -1907
- package/engines/ferretdb/restore.ts +0 -357
- package/engines/file-based-utils.ts +0 -262
- package/engines/index.ts +0 -131
- package/engines/influxdb/README.md +0 -180
- package/engines/influxdb/api-client.ts +0 -64
- package/engines/influxdb/backup.ts +0 -160
- package/engines/influxdb/binary-manager.ts +0 -110
- package/engines/influxdb/binary-urls.ts +0 -69
- package/engines/influxdb/hostdb-releases.ts +0 -23
- package/engines/influxdb/index.ts +0 -1272
- package/engines/influxdb/restore.ts +0 -417
- package/engines/influxdb/version-maps.ts +0 -75
- package/engines/influxdb/version-validator.ts +0 -128
- package/engines/mariadb/README.md +0 -141
- package/engines/mariadb/backup.ts +0 -233
- package/engines/mariadb/binary-manager.ts +0 -45
- package/engines/mariadb/hostdb-releases.ts +0 -23
- package/engines/mariadb/index.ts +0 -1300
- package/engines/mariadb/restore.ts +0 -447
- package/engines/mariadb/version-maps.ts +0 -72
- package/engines/mariadb/version-validator.ts +0 -181
- package/engines/meilisearch/README.md +0 -255
- package/engines/meilisearch/api-client.ts +0 -61
- package/engines/meilisearch/backup.ts +0 -233
- package/engines/meilisearch/binary-manager.ts +0 -43
- package/engines/meilisearch/binary-urls.ts +0 -69
- package/engines/meilisearch/hostdb-releases.ts +0 -26
- package/engines/meilisearch/index.ts +0 -1292
- package/engines/meilisearch/restore.ts +0 -219
- package/engines/meilisearch/version-maps.ts +0 -78
- package/engines/meilisearch/version-validator.ts +0 -128
- package/engines/mongodb/README.md +0 -162
- package/engines/mongodb/backup.ts +0 -127
- package/engines/mongodb/binary-manager.ts +0 -48
- package/engines/mongodb/binary-urls.ts +0 -63
- package/engines/mongodb/cli-utils.ts +0 -171
- package/engines/mongodb/hostdb-releases.ts +0 -91
- package/engines/mongodb/index.ts +0 -1118
- package/engines/mongodb/restore.ts +0 -361
- package/engines/mongodb/version-maps.ts +0 -91
- package/engines/mongodb/version-validator.ts +0 -160
- package/engines/mysql/README.md +0 -142
- package/engines/mysql/backup.ts +0 -270
- package/engines/mysql/binary-detection.ts +0 -408
- package/engines/mysql/binary-manager.ts +0 -42
- package/engines/mysql/binary-urls.ts +0 -104
- package/engines/mysql/index.ts +0 -1361
- package/engines/mysql/restore.ts +0 -500
- package/engines/mysql/version-maps.ts +0 -91
- package/engines/mysql/version-validator.ts +0 -369
- package/engines/postgresql/README.md +0 -158
- package/engines/postgresql/backup.ts +0 -151
- package/engines/postgresql/binary-manager.ts +0 -114
- package/engines/postgresql/binary-urls.ts +0 -99
- package/engines/postgresql/hostdb-releases.ts +0 -26
- package/engines/postgresql/index.ts +0 -1143
- package/engines/postgresql/remote-version.ts +0 -161
- package/engines/postgresql/restore.ts +0 -342
- package/engines/postgresql/version-maps.ts +0 -83
- package/engines/postgresql/version-validator.ts +0 -413
- package/engines/qdrant/README.md +0 -222
- package/engines/qdrant/api-client.ts +0 -61
- package/engines/qdrant/backup.ts +0 -165
- package/engines/qdrant/binary-manager.ts +0 -43
- package/engines/qdrant/binary-urls.ts +0 -115
- package/engines/qdrant/cli-utils.ts +0 -43
- package/engines/qdrant/hostdb-releases.ts +0 -23
- package/engines/qdrant/index.ts +0 -1312
- package/engines/qdrant/restore.ts +0 -203
- package/engines/qdrant/version-maps.ts +0 -78
- package/engines/qdrant/version-validator.ts +0 -128
- package/engines/questdb/README.md +0 -334
- package/engines/questdb/backup.ts +0 -220
- package/engines/questdb/binary-manager.ts +0 -310
- package/engines/questdb/binary-urls.ts +0 -34
- package/engines/questdb/hostdb-releases.ts +0 -23
- package/engines/questdb/index.ts +0 -1023
- package/engines/questdb/restore.ts +0 -260
- package/engines/questdb/version-maps.ts +0 -37
- package/engines/questdb/version-validator.ts +0 -121
- package/engines/redis/README.md +0 -173
- package/engines/redis/backup.ts +0 -389
- package/engines/redis/binary-manager.ts +0 -44
- package/engines/redis/binary-urls.ts +0 -117
- package/engines/redis/cli-utils.ts +0 -42
- package/engines/redis/hostdb-releases.ts +0 -23
- package/engines/redis/index.ts +0 -1583
- package/engines/redis/restore.ts +0 -443
- package/engines/redis/version-maps.ts +0 -81
- package/engines/redis/version-validator.ts +0 -131
- package/engines/sqlite/README.md +0 -162
- package/engines/sqlite/binary-manager.ts +0 -52
- package/engines/sqlite/hostdb-releases.ts +0 -23
- package/engines/sqlite/index.ts +0 -641
- package/engines/sqlite/registry.ts +0 -198
- package/engines/sqlite/scanner.ts +0 -22
- package/engines/sqlite/version-maps.ts +0 -64
- package/engines/surrealdb/README.md +0 -218
- package/engines/surrealdb/backup.ts +0 -131
- package/engines/surrealdb/binary-manager.ts +0 -45
- package/engines/surrealdb/binary-urls.ts +0 -40
- package/engines/surrealdb/cli-utils.ts +0 -173
- package/engines/surrealdb/hostdb-releases.ts +0 -23
- package/engines/surrealdb/index.ts +0 -1246
- package/engines/surrealdb/restore.ts +0 -302
- package/engines/surrealdb/version-maps.ts +0 -41
- package/engines/tigerbeetle/README.md +0 -61
- package/engines/tigerbeetle/backup.ts +0 -49
- package/engines/tigerbeetle/binary-manager.ts +0 -95
- package/engines/tigerbeetle/binary-urls.ts +0 -62
- package/engines/tigerbeetle/hostdb-releases.ts +0 -26
- package/engines/tigerbeetle/index.ts +0 -746
- package/engines/tigerbeetle/restore.ts +0 -130
- package/engines/tigerbeetle/version-validator.ts +0 -126
- package/engines/typedb/backup.ts +0 -167
- package/engines/typedb/binary-manager.ts +0 -200
- package/engines/typedb/binary-urls.ts +0 -40
- package/engines/typedb/cli-utils.ts +0 -210
- package/engines/typedb/hostdb-releases.ts +0 -23
- package/engines/typedb/index.ts +0 -1275
- package/engines/typedb/restore.ts +0 -377
- package/engines/typedb/version-maps.ts +0 -48
- package/engines/typedb/version-validator.ts +0 -127
- package/engines/valkey/README.md +0 -219
- package/engines/valkey/backup.ts +0 -389
- package/engines/valkey/binary-manager.ts +0 -45
- package/engines/valkey/binary-urls.ts +0 -122
- package/engines/valkey/cli-utils.ts +0 -42
- package/engines/valkey/hostdb-releases.ts +0 -23
- package/engines/valkey/index.ts +0 -1585
- package/engines/valkey/restore.ts +0 -446
- package/engines/valkey/version-maps.ts +0 -81
- package/engines/valkey/version-validator.ts +0 -131
- package/engines/weaviate/README.md +0 -302
- package/engines/weaviate/api-client.ts +0 -61
- package/engines/weaviate/backup.ts +0 -145
- package/engines/weaviate/binary-manager.ts +0 -80
- package/engines/weaviate/binary-urls.ts +0 -115
- package/engines/weaviate/cli-utils.ts +0 -43
- package/engines/weaviate/hostdb-releases.ts +0 -23
- package/engines/weaviate/index.ts +0 -1139
- package/engines/weaviate/restore.ts +0 -235
- package/engines/weaviate/version-maps.ts +0 -78
- package/engines/weaviate/version-validator.ts +0 -128
- package/types/index.ts +0 -624
- /package/{config → dist/config}/engines.json +0 -0
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MySQL/MariaDB Version Validator
|
|
3
|
-
*
|
|
4
|
-
* Validates compatibility between mysql client version and dump file version.
|
|
5
|
-
* MySQL is generally more lenient than PostgreSQL, but we still warn about:
|
|
6
|
-
* - MariaDB dumps being restored to MySQL (and vice versa)
|
|
7
|
-
* - Newer dumps being restored to older clients
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { exec } from 'child_process'
|
|
11
|
-
import { promisify } from 'util'
|
|
12
|
-
import { createReadStream } from 'fs'
|
|
13
|
-
import { createInterface } from 'readline'
|
|
14
|
-
import {
|
|
15
|
-
SpinDBError,
|
|
16
|
-
ErrorCodes,
|
|
17
|
-
logWarning,
|
|
18
|
-
logDebug,
|
|
19
|
-
} from '../../core/error-handler'
|
|
20
|
-
import { getMysqlClientPath } from './binary-detection'
|
|
21
|
-
|
|
22
|
-
const execAsync = promisify(exec)
|
|
23
|
-
|
|
24
|
-
// =============================================================================
|
|
25
|
-
// Types
|
|
26
|
-
// =============================================================================
|
|
27
|
-
|
|
28
|
-
export type VersionInfo = {
|
|
29
|
-
major: number
|
|
30
|
-
minor: number
|
|
31
|
-
patch: number
|
|
32
|
-
full: string
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type MySQLVariant = 'mysql' | 'mariadb' | 'unknown'
|
|
36
|
-
|
|
37
|
-
export type DumpInfo = {
|
|
38
|
-
version: VersionInfo | null
|
|
39
|
-
variant: MySQLVariant
|
|
40
|
-
serverVersion?: string
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export type CompatibilityResult = {
|
|
44
|
-
compatible: boolean
|
|
45
|
-
dumpInfo: DumpInfo
|
|
46
|
-
toolVersion: VersionInfo
|
|
47
|
-
toolVariant: MySQLVariant
|
|
48
|
-
warning?: string
|
|
49
|
-
error?: string
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// =============================================================================
|
|
53
|
-
// Version Parsing
|
|
54
|
-
// =============================================================================
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Parse version from mysql --version output
|
|
58
|
-
* Examples:
|
|
59
|
-
* "mysql Ver 8.0.35 for macos14.0 on arm64 (Homebrew)"
|
|
60
|
-
* "mysql Ver 14.14 Distrib 5.7.44, for Linux (x86_64)" (MySQL 5.7)
|
|
61
|
-
* "mysql Ver 15.1 Distrib 10.11.6-MariaDB, for osx10.19 (arm64)"
|
|
62
|
-
* "mysql from 11.4.3-MariaDB, client 15.2 for osx10.20 (arm64)"
|
|
63
|
-
*/
|
|
64
|
-
export function parseToolVersion(output: string): {
|
|
65
|
-
version: VersionInfo
|
|
66
|
-
variant: MySQLVariant
|
|
67
|
-
} {
|
|
68
|
-
// Check for MariaDB - must explicitly contain "mariadb" in the string
|
|
69
|
-
// Note: Both MySQL 5.7 and MariaDB use "Distrib", but only MariaDB includes "-MariaDB"
|
|
70
|
-
const isMariaDB = output.toLowerCase().includes('mariadb')
|
|
71
|
-
|
|
72
|
-
let match: RegExpMatchArray | null = null
|
|
73
|
-
|
|
74
|
-
if (isMariaDB) {
|
|
75
|
-
// MariaDB: "Distrib 10.11.6-MariaDB" or "from 11.4.3-MariaDB"
|
|
76
|
-
match = output.match(/(?:Distrib|from)\s+(\d+)\.(\d+)\.(\d+)/)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (!match) {
|
|
80
|
-
// MySQL with Distrib: "Distrib 5.7.44" (MySQL 5.7 style)
|
|
81
|
-
match = output.match(/Distrib\s+(\d+)\.(\d+)\.(\d+)/)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (!match) {
|
|
85
|
-
// MySQL: "Ver 8.0.35"
|
|
86
|
-
match = output.match(/Ver\s+(\d+)\.(\d+)(?:\.(\d+))?/)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (!match) {
|
|
90
|
-
// Generic fallback
|
|
91
|
-
match = output.match(/(\d+)\.(\d+)(?:\.(\d+))?/)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (!match) {
|
|
95
|
-
throw new Error(`Cannot parse version from: ${output}`)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return {
|
|
99
|
-
version: {
|
|
100
|
-
major: parseInt(match[1], 10),
|
|
101
|
-
minor: parseInt(match[2], 10),
|
|
102
|
-
patch: parseInt(match[3] || '0', 10),
|
|
103
|
-
full: match[0].replace(/^(Ver|Distrib|from)\s+/, ''),
|
|
104
|
-
},
|
|
105
|
-
variant: isMariaDB ? 'mariadb' : 'mysql',
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Read the first N lines of a file
|
|
110
|
-
async function readFirstLines(
|
|
111
|
-
filePath: string,
|
|
112
|
-
lineCount: number,
|
|
113
|
-
): Promise<string> {
|
|
114
|
-
return new Promise((resolve, reject) => {
|
|
115
|
-
const lines: string[] = []
|
|
116
|
-
const stream = createReadStream(filePath, { encoding: 'utf8' })
|
|
117
|
-
const rl = createInterface({ input: stream })
|
|
118
|
-
|
|
119
|
-
rl.on('line', (line) => {
|
|
120
|
-
lines.push(line)
|
|
121
|
-
if (lines.length >= lineCount) {
|
|
122
|
-
rl.close()
|
|
123
|
-
stream.destroy()
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
rl.on('close', () => {
|
|
128
|
-
resolve(lines.join('\n'))
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
rl.on('error', reject)
|
|
132
|
-
stream.on('error', reject)
|
|
133
|
-
})
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Parse version from dump file header
|
|
138
|
-
*
|
|
139
|
-
* MySQL dump header:
|
|
140
|
-
* -- MySQL dump 10.13 Distrib 8.0.35, for macos14.0 (arm64)
|
|
141
|
-
* -- Server version 8.0.35
|
|
142
|
-
*
|
|
143
|
-
* MariaDB dump header:
|
|
144
|
-
* -- MariaDB dump 10.19-11.4.3-MariaDB, for osx10.20 (arm64)
|
|
145
|
-
* -- Server version 11.4.3-MariaDB
|
|
146
|
-
*/
|
|
147
|
-
export async function parseDumpVersion(dumpPath: string): Promise<DumpInfo> {
|
|
148
|
-
try {
|
|
149
|
-
const header = await readFirstLines(dumpPath, 30)
|
|
150
|
-
|
|
151
|
-
// Detect variant
|
|
152
|
-
let variant: MySQLVariant = 'unknown'
|
|
153
|
-
if (header.includes('MariaDB dump') || header.includes('-MariaDB')) {
|
|
154
|
-
variant = 'mariadb'
|
|
155
|
-
} else if (header.includes('MySQL dump')) {
|
|
156
|
-
variant = 'mysql'
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Try to get server version (more accurate than dump tool version)
|
|
160
|
-
// "-- Server version 8.0.35" or "-- Server version 11.4.3-MariaDB"
|
|
161
|
-
const serverMatch = header.match(
|
|
162
|
-
/--\s*Server version\s+(\d+)\.(\d+)(?:\.(\d+))?/,
|
|
163
|
-
)
|
|
164
|
-
if (serverMatch) {
|
|
165
|
-
return {
|
|
166
|
-
version: {
|
|
167
|
-
major: parseInt(serverMatch[1], 10),
|
|
168
|
-
minor: parseInt(serverMatch[2], 10),
|
|
169
|
-
patch: parseInt(serverMatch[3] || '0', 10),
|
|
170
|
-
full: `${serverMatch[1]}.${serverMatch[2]}${serverMatch[3] ? `.${serverMatch[3]}` : ''}`,
|
|
171
|
-
},
|
|
172
|
-
variant,
|
|
173
|
-
serverVersion: header.match(/--\s*Server version\s+([^\n]+)/)?.[1],
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// Fall back to Distrib version in header
|
|
178
|
-
// "Distrib 8.0.35" or "10.19-11.4.3-MariaDB"
|
|
179
|
-
let distribMatch = header.match(/Distrib\s+(\d+)\.(\d+)(?:\.(\d+))?/)
|
|
180
|
-
if (!distribMatch && variant === 'mariadb') {
|
|
181
|
-
// MariaDB format: "dump 10.19-11.4.3-MariaDB"
|
|
182
|
-
distribMatch = header.match(/dump\s+[\d.]+-(\d+)\.(\d+)\.(\d+)/)
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (distribMatch) {
|
|
186
|
-
return {
|
|
187
|
-
version: {
|
|
188
|
-
major: parseInt(distribMatch[1], 10),
|
|
189
|
-
minor: parseInt(distribMatch[2], 10),
|
|
190
|
-
patch: parseInt(distribMatch[3] || '0', 10),
|
|
191
|
-
full: `${distribMatch[1]}.${distribMatch[2]}${distribMatch[3] ? `.${distribMatch[3]}` : ''}`,
|
|
192
|
-
},
|
|
193
|
-
variant,
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return { version: null, variant }
|
|
198
|
-
} catch (error) {
|
|
199
|
-
logDebug('Failed to parse dump version', {
|
|
200
|
-
dumpPath,
|
|
201
|
-
error: error instanceof Error ? error.message : String(error),
|
|
202
|
-
})
|
|
203
|
-
return { version: null, variant: 'unknown' }
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Get the version of the mysql client
|
|
208
|
-
export async function getMysqlClientVersion(): Promise<{
|
|
209
|
-
version: VersionInfo
|
|
210
|
-
variant: MySQLVariant
|
|
211
|
-
}> {
|
|
212
|
-
const mysqlPath = await getMysqlClientPath()
|
|
213
|
-
if (!mysqlPath) {
|
|
214
|
-
throw new Error('mysql client not found')
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const { stdout } = await execAsync(`"${mysqlPath}" --version`)
|
|
218
|
-
return parseToolVersion(stdout)
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// =============================================================================
|
|
222
|
-
// Compatibility Checking
|
|
223
|
-
// =============================================================================
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Check version compatibility
|
|
227
|
-
*
|
|
228
|
-
* MySQL/MariaDB compatibility matrix:
|
|
229
|
-
* | Scenario | Result |
|
|
230
|
-
* |----------|--------|
|
|
231
|
-
* | MySQL 8 client + MySQL 8 dump | ✅ Works |
|
|
232
|
-
* | MySQL 8 client + MySQL 5.7 dump | ✅ Works (backwards compatible) |
|
|
233
|
-
* | MySQL 5.7 client + MySQL 8 dump | ⚠️ May have issues |
|
|
234
|
-
* | MariaDB client + MySQL dump | ⚠️ Warning (mostly compatible) |
|
|
235
|
-
* | MySQL client + MariaDB dump | ⚠️ Warning (mostly compatible) |
|
|
236
|
-
*/
|
|
237
|
-
export function checkVersionCompatibility(
|
|
238
|
-
dumpInfo: DumpInfo,
|
|
239
|
-
toolVersion: VersionInfo,
|
|
240
|
-
toolVariant: MySQLVariant,
|
|
241
|
-
): CompatibilityResult {
|
|
242
|
-
const result: CompatibilityResult = {
|
|
243
|
-
compatible: true,
|
|
244
|
-
dumpInfo,
|
|
245
|
-
toolVersion,
|
|
246
|
-
toolVariant,
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// If we couldn't parse dump version, proceed with warning
|
|
250
|
-
if (!dumpInfo.version) {
|
|
251
|
-
result.warning = 'Could not detect dump version. Proceeding anyway.'
|
|
252
|
-
return result
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// Check for variant mismatch (MySQL vs MariaDB)
|
|
256
|
-
if (
|
|
257
|
-
dumpInfo.variant !== 'unknown' &&
|
|
258
|
-
toolVariant !== 'unknown' &&
|
|
259
|
-
dumpInfo.variant !== toolVariant
|
|
260
|
-
) {
|
|
261
|
-
result.warning =
|
|
262
|
-
`Dump was created with ${dumpInfo.variant === 'mariadb' ? 'MariaDB' : 'MySQL'}, ` +
|
|
263
|
-
`but restoring with ${toolVariant === 'mariadb' ? 'MariaDB' : 'MySQL'}. ` +
|
|
264
|
-
`This usually works, but some features may not be compatible.`
|
|
265
|
-
return result
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// MySQL 8 introduced significant changes
|
|
269
|
-
// Restoring MySQL 8+ dump with MySQL 5.x client may fail
|
|
270
|
-
if (dumpInfo.version.major >= 8 && toolVersion.major < 8) {
|
|
271
|
-
result.compatible = false
|
|
272
|
-
result.error =
|
|
273
|
-
`Dump was created with MySQL ${dumpInfo.version.major}, ` +
|
|
274
|
-
`but your mysql client is version ${toolVersion.major}. ` +
|
|
275
|
-
`MySQL 8 dumps may contain syntax not supported by older clients.`
|
|
276
|
-
return result
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// MariaDB 10.x to MySQL may have issues with specific features
|
|
280
|
-
if (
|
|
281
|
-
dumpInfo.variant === 'mariadb' &&
|
|
282
|
-
toolVariant === 'mysql' &&
|
|
283
|
-
dumpInfo.version.major >= 10
|
|
284
|
-
) {
|
|
285
|
-
result.warning =
|
|
286
|
-
`Dump was created with MariaDB ${dumpInfo.version.full}. ` +
|
|
287
|
-
`Some MariaDB-specific features may not restore correctly to MySQL.`
|
|
288
|
-
return result
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// Warn if dump is newer than tool (any variant)
|
|
292
|
-
if (dumpInfo.version.major > toolVersion.major) {
|
|
293
|
-
result.warning =
|
|
294
|
-
`Dump was created with version ${dumpInfo.version.full}, ` +
|
|
295
|
-
`but your client is version ${toolVersion.full}. ` +
|
|
296
|
-
`Some features may not restore correctly.`
|
|
297
|
-
return result
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// Warn if dump is very old (5+ years)
|
|
301
|
-
if (
|
|
302
|
-
dumpInfo.version.major < 5 ||
|
|
303
|
-
(dumpInfo.version.major === 5 && dumpInfo.version.minor < 7)
|
|
304
|
-
) {
|
|
305
|
-
result.warning =
|
|
306
|
-
`Dump was created with MySQL ${dumpInfo.version.full}. ` +
|
|
307
|
-
`This is a very old version; some data types may not import correctly.`
|
|
308
|
-
return result
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return result
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// =============================================================================
|
|
315
|
-
// Main Validation Function
|
|
316
|
-
// =============================================================================
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Validate that a dump file can be restored with the available mysql client
|
|
320
|
-
*
|
|
321
|
-
* @throws SpinDBError if versions are incompatible
|
|
322
|
-
*/
|
|
323
|
-
export async function validateRestoreCompatibility(options: {
|
|
324
|
-
dumpPath: string
|
|
325
|
-
}): Promise<{
|
|
326
|
-
dumpInfo: DumpInfo
|
|
327
|
-
toolVersion: VersionInfo
|
|
328
|
-
toolVariant: MySQLVariant
|
|
329
|
-
}> {
|
|
330
|
-
const { dumpPath } = options
|
|
331
|
-
|
|
332
|
-
// Get tool version
|
|
333
|
-
const { version: toolVersion, variant: toolVariant } =
|
|
334
|
-
await getMysqlClientVersion()
|
|
335
|
-
logDebug('mysql client version detected', {
|
|
336
|
-
version: toolVersion.full,
|
|
337
|
-
variant: toolVariant,
|
|
338
|
-
})
|
|
339
|
-
|
|
340
|
-
// Get dump version
|
|
341
|
-
const dumpInfo = await parseDumpVersion(dumpPath)
|
|
342
|
-
if (dumpInfo.version) {
|
|
343
|
-
logDebug('Dump version detected', {
|
|
344
|
-
version: dumpInfo.version.full,
|
|
345
|
-
variant: dumpInfo.variant,
|
|
346
|
-
})
|
|
347
|
-
} else {
|
|
348
|
-
logDebug('Could not detect dump version')
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// Check compatibility
|
|
352
|
-
const result = checkVersionCompatibility(dumpInfo, toolVersion, toolVariant)
|
|
353
|
-
|
|
354
|
-
if (!result.compatible) {
|
|
355
|
-
throw new SpinDBError(
|
|
356
|
-
ErrorCodes.VERSION_MISMATCH,
|
|
357
|
-
result.error!,
|
|
358
|
-
'fatal',
|
|
359
|
-
'Install a newer version of MySQL client tools',
|
|
360
|
-
{ dumpInfo, toolVersion, toolVariant },
|
|
361
|
-
)
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
if (result.warning) {
|
|
365
|
-
logWarning(result.warning)
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
return { dumpInfo, toolVersion, toolVariant }
|
|
369
|
-
}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
# PostgreSQL Engine Implementation
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
PostgreSQL is a traditional SQL database with full server-based lifecycle management. SpinDB downloads PostgreSQL binaries from hostdb and manages them locally.
|
|
6
|
-
|
|
7
|
-
## Platform Support
|
|
8
|
-
|
|
9
|
-
| Platform | Architecture | Status | Notes |
|
|
10
|
-
|----------|--------------|--------|-------|
|
|
11
|
-
| darwin | x64 | Supported | Uses hostdb binaries |
|
|
12
|
-
| darwin | arm64 | Supported | Uses hostdb binaries (Apple Silicon) |
|
|
13
|
-
| linux | x64 | Supported | Uses hostdb binaries |
|
|
14
|
-
| linux | arm64 | Supported | Uses hostdb binaries |
|
|
15
|
-
| win32 | x64 | Supported | Uses EDB binaries (uploaded to hostdb) |
|
|
16
|
-
|
|
17
|
-
### Windows Binary Source
|
|
18
|
-
|
|
19
|
-
PostgreSQL on Windows uses [EnterpriseDB (EDB)](https://www.enterprisedb.com/download-postgresql-binaries) binaries. These are downloaded from EDB's CDN and uploaded to hostdb for consistency. File IDs are maintained in `edb-binary-urls.ts`.
|
|
20
|
-
|
|
21
|
-
## Binary Packaging
|
|
22
|
-
|
|
23
|
-
### Archive Format
|
|
24
|
-
- **Unix (macOS/Linux)**: `tar.gz`
|
|
25
|
-
- **Windows**: `zip`
|
|
26
|
-
|
|
27
|
-
### Archive Structure
|
|
28
|
-
```
|
|
29
|
-
postgresql/
|
|
30
|
-
├── bin/
|
|
31
|
-
│ ├── postgres # Main server binary
|
|
32
|
-
│ ├── pg_ctl # Server control utility
|
|
33
|
-
│ ├── initdb # Database cluster initialization
|
|
34
|
-
│ ├── psql # Interactive terminal
|
|
35
|
-
│ ├── pg_dump # Backup utility
|
|
36
|
-
│ ├── pg_restore # Restore utility
|
|
37
|
-
│ └── pg_basebackup # Streaming backup
|
|
38
|
-
└── lib/ # Shared libraries
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Version Map Sync
|
|
42
|
-
|
|
43
|
-
The `version-maps.ts` file must stay synchronized with hostdb's `releases.json`:
|
|
44
|
-
|
|
45
|
-
```typescript
|
|
46
|
-
export const POSTGRESQL_VERSION_MAP: Record<string, string> = {
|
|
47
|
-
'15': '15.x.x',
|
|
48
|
-
'16': '16.x.x',
|
|
49
|
-
'17': '17.x.x',
|
|
50
|
-
'18': '18.x.x',
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Implementation Details
|
|
55
|
-
|
|
56
|
-
### Binary Manager
|
|
57
|
-
|
|
58
|
-
PostgreSQL uses `BaseServerBinaryManager` with a custom `verify()` override for version parsing. This is necessary because:
|
|
59
|
-
|
|
60
|
-
1. PostgreSQL's version output differs between EDB and standard builds
|
|
61
|
-
2. Version format: `postgres (PostgreSQL) X.Y` or `postgres (PostgreSQL) X.Y - Percona Server for PostgreSQL X.Y.Z`
|
|
62
|
-
|
|
63
|
-
### Version Parsing Quirks
|
|
64
|
-
|
|
65
|
-
- **Strip trailing .0**: Versions like `17.0` are normalized to match `17`
|
|
66
|
-
- **Accept major.minor matches**: `18.1.0` matches requested version `18.1`
|
|
67
|
-
- **EDB format handling**: EDB binaries may include additional branding in version output
|
|
68
|
-
|
|
69
|
-
### Default Configuration
|
|
70
|
-
|
|
71
|
-
- **Default Port**: 5432 (auto-increments on conflict)
|
|
72
|
-
- **Default Database**: Name derived from container name
|
|
73
|
-
- **PID File**: `postmaster.pid` in container directory
|
|
74
|
-
|
|
75
|
-
### initdb and pg_ctl
|
|
76
|
-
|
|
77
|
-
PostgreSQL uses a two-step initialization:
|
|
78
|
-
1. `initdb` creates the data directory structure
|
|
79
|
-
2. `pg_ctl start` launches the server in background mode
|
|
80
|
-
|
|
81
|
-
### Connection String Format
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
postgresql://127.0.0.1:{port}/{database}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Backup & Restore
|
|
88
|
-
|
|
89
|
-
### Backup Formats
|
|
90
|
-
|
|
91
|
-
| Format | Extension | Tool | Notes |
|
|
92
|
-
|--------|-----------|------|-------|
|
|
93
|
-
| sql | `.sql` | pg_dump | Plain text SQL, portable |
|
|
94
|
-
| custom | `.dump` | pg_dump -Fc | Binary, supports parallel restore |
|
|
95
|
-
|
|
96
|
-
### Restore Methods
|
|
97
|
-
|
|
98
|
-
- **SQL format**: Restored via `psql -f`
|
|
99
|
-
- **Custom format**: Restored via `pg_restore`
|
|
100
|
-
|
|
101
|
-
## Integration Test Notes
|
|
102
|
-
|
|
103
|
-
### Reserved Ports
|
|
104
|
-
|
|
105
|
-
Integration tests use reserved ports to avoid conflicts:
|
|
106
|
-
- **Test Ports**: 5454-5456 (NOT 5432)
|
|
107
|
-
|
|
108
|
-
### Test Fixtures
|
|
109
|
-
|
|
110
|
-
Located in `tests/fixtures/postgresql/seeds/`:
|
|
111
|
-
- `sample-db.sql`: Contains 5 test_user records
|
|
112
|
-
|
|
113
|
-
## Docker E2E Test Notes
|
|
114
|
-
|
|
115
|
-
PostgreSQL is tested in Docker E2E with full lifecycle verification:
|
|
116
|
-
- Container creation with `initdb`
|
|
117
|
-
- Server start/stop
|
|
118
|
-
- Database operations
|
|
119
|
-
- Backup and restore
|
|
120
|
-
- Multi-database support
|
|
121
|
-
|
|
122
|
-
## Known Issues & Gotchas
|
|
123
|
-
|
|
124
|
-
### 1. Windows Binary Differences
|
|
125
|
-
|
|
126
|
-
Windows uses EDB binaries which have slightly different behavior:
|
|
127
|
-
- File paths use Windows conventions internally
|
|
128
|
-
- Some environment variables differ
|
|
129
|
-
|
|
130
|
-
### 2. Port Conflicts
|
|
131
|
-
|
|
132
|
-
When the default port is in use, SpinDB auto-increments (5432 -> 5433 -> etc.).
|
|
133
|
-
|
|
134
|
-
### 3. Connection Termination
|
|
135
|
-
|
|
136
|
-
Before dropping a database, active connections must be terminated. The engine uses:
|
|
137
|
-
```sql
|
|
138
|
-
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'dbname';
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Special handling for single quotes in shell commands on different platforms.
|
|
142
|
-
|
|
143
|
-
### 4. Orphaned Container Support
|
|
144
|
-
|
|
145
|
-
If PostgreSQL binaries are deleted while containers exist, starting those containers prompts the user to re-download the binaries.
|
|
146
|
-
|
|
147
|
-
## CI/CD Notes
|
|
148
|
-
|
|
149
|
-
### GitHub Actions Cache Step
|
|
150
|
-
|
|
151
|
-
PostgreSQL binaries are cached in CI to speed up test runs:
|
|
152
|
-
```yaml
|
|
153
|
-
- name: Cache PostgreSQL binaries
|
|
154
|
-
uses: actions/cache@v4
|
|
155
|
-
with:
|
|
156
|
-
path: ~/.spindb/bin/postgresql-*
|
|
157
|
-
key: postgresql-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('engines/postgresql/version-maps.ts') }}
|
|
158
|
-
```
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PostgreSQL Backup
|
|
3
|
-
*
|
|
4
|
-
* Creates database backups in SQL or custom (.dump) format using pg_dump.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { spawn, type SpawnOptions } from 'child_process'
|
|
8
|
-
import { stat } from 'fs/promises'
|
|
9
|
-
import { existsSync } from 'fs'
|
|
10
|
-
import { join } from 'path'
|
|
11
|
-
import { configManager } from '../../core/config-manager'
|
|
12
|
-
import {
|
|
13
|
-
getWindowsSpawnOptions,
|
|
14
|
-
platformService,
|
|
15
|
-
} from '../../core/platform-service'
|
|
16
|
-
import { defaults } from '../../config/defaults'
|
|
17
|
-
import { paths } from '../../config/paths'
|
|
18
|
-
import { normalizeVersion } from './version-maps'
|
|
19
|
-
import type { ContainerConfig, BackupOptions, BackupResult } from '../../types'
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Get pg_dump path for a specific PostgreSQL version.
|
|
23
|
-
*
|
|
24
|
-
* Prioritizes SpinDB-managed binaries that match the container's version,
|
|
25
|
-
* falling back to system pg_dump only if no matching version is found.
|
|
26
|
-
*
|
|
27
|
-
* @param containerVersion - The container's PostgreSQL version (e.g., "18" or "18.1.0")
|
|
28
|
-
* @returns Path to the version-matched pg_dump binary
|
|
29
|
-
*/
|
|
30
|
-
async function getPgDumpPath(containerVersion: string): Promise<string> {
|
|
31
|
-
// Normalize to full version (e.g., "18" -> "18.1.0")
|
|
32
|
-
const fullVersion = normalizeVersion(containerVersion)
|
|
33
|
-
|
|
34
|
-
// Get platform info for building the binary path
|
|
35
|
-
const platformInfo = platformService.getPlatformInfo()
|
|
36
|
-
const ext = platformInfo.platform === 'win32' ? '.exe' : ''
|
|
37
|
-
|
|
38
|
-
// Try to find SpinDB-managed pg_dump for the matching version
|
|
39
|
-
const versionedBinPath = paths.getBinaryPath({
|
|
40
|
-
engine: 'postgresql',
|
|
41
|
-
version: fullVersion,
|
|
42
|
-
platform: platformInfo.platform,
|
|
43
|
-
arch: platformInfo.arch,
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
const versionedPgDump = join(versionedBinPath, 'bin', `pg_dump${ext}`)
|
|
47
|
-
|
|
48
|
-
if (existsSync(versionedPgDump)) {
|
|
49
|
-
return versionedPgDump
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Try to find any installed version for this major version
|
|
53
|
-
const majorVersion = containerVersion.split('.')[0]
|
|
54
|
-
const installed = paths.findInstalledBinaryForMajor(
|
|
55
|
-
'postgresql',
|
|
56
|
-
majorVersion,
|
|
57
|
-
platformInfo.platform,
|
|
58
|
-
platformInfo.arch,
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
if (installed) {
|
|
62
|
-
const installedPgDump = join(installed.path, 'bin', `pg_dump${ext}`)
|
|
63
|
-
if (existsSync(installedPgDump)) {
|
|
64
|
-
return installedPgDump
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Fall back to globally registered pg_dump (system binary)
|
|
69
|
-
const systemPgDump = await configManager.getBinaryPath('pg_dump')
|
|
70
|
-
if (systemPgDump) {
|
|
71
|
-
return systemPgDump
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
throw new Error(
|
|
75
|
-
`pg_dump not found for PostgreSQL ${containerVersion}. ` +
|
|
76
|
-
`Either download PostgreSQL binaries with 'spindb create --engine postgresql --version ${majorVersion}' ` +
|
|
77
|
-
'or install PostgreSQL client tools:\n' +
|
|
78
|
-
' macOS: brew install libpq && brew link --force libpq\n' +
|
|
79
|
-
' Ubuntu/Debian: apt install postgresql-client\n\n' +
|
|
80
|
-
'Or configure manually: spindb config set pg_dump /path/to/pg_dump',
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Create a backup of a PostgreSQL database
|
|
86
|
-
*
|
|
87
|
-
* CLI equivalent:
|
|
88
|
-
* - SQL format: pg_dump -Fp -h 127.0.0.1 -p {port} -U postgres -d {database} -f {outputPath}
|
|
89
|
-
* - Dump format: pg_dump -Fc -h 127.0.0.1 -p {port} -U postgres -d {database} -f {outputPath}
|
|
90
|
-
*/
|
|
91
|
-
export async function createBackup(
|
|
92
|
-
container: ContainerConfig,
|
|
93
|
-
outputPath: string,
|
|
94
|
-
options: BackupOptions,
|
|
95
|
-
): Promise<BackupResult> {
|
|
96
|
-
const { port, version } = container
|
|
97
|
-
const { database, format } = options
|
|
98
|
-
|
|
99
|
-
const pgDumpPath = await getPgDumpPath(version)
|
|
100
|
-
|
|
101
|
-
// -Fp = plain SQL format, -Fc = custom format
|
|
102
|
-
const formatFlag = format === 'sql' ? '-Fp' : '-Fc'
|
|
103
|
-
|
|
104
|
-
return new Promise((resolve, reject) => {
|
|
105
|
-
const args = [
|
|
106
|
-
'-h',
|
|
107
|
-
'127.0.0.1',
|
|
108
|
-
'-p',
|
|
109
|
-
String(port),
|
|
110
|
-
'-U',
|
|
111
|
-
defaults.superuser,
|
|
112
|
-
'-d',
|
|
113
|
-
database,
|
|
114
|
-
formatFlag,
|
|
115
|
-
'-f',
|
|
116
|
-
outputPath,
|
|
117
|
-
]
|
|
118
|
-
|
|
119
|
-
const spawnOptions: SpawnOptions = {
|
|
120
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
121
|
-
...getWindowsSpawnOptions(),
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const proc = spawn(pgDumpPath, args, spawnOptions)
|
|
125
|
-
|
|
126
|
-
let stderr = ''
|
|
127
|
-
|
|
128
|
-
proc.stderr?.on('data', (data: Buffer) => {
|
|
129
|
-
stderr += data.toString()
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
proc.on('error', (err: NodeJS.ErrnoException) => {
|
|
133
|
-
reject(err)
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
proc.on('close', async (code) => {
|
|
137
|
-
if (code === 0) {
|
|
138
|
-
// Get file size
|
|
139
|
-
const stats = await stat(outputPath)
|
|
140
|
-
resolve({
|
|
141
|
-
path: outputPath,
|
|
142
|
-
format: format === 'sql' ? 'sql' : 'custom',
|
|
143
|
-
size: stats.size,
|
|
144
|
-
})
|
|
145
|
-
} else {
|
|
146
|
-
const errorMessage = stderr || `pg_dump exited with code ${code}`
|
|
147
|
-
reject(new Error(errorMessage))
|
|
148
|
-
}
|
|
149
|
-
})
|
|
150
|
-
})
|
|
151
|
-
}
|