Add pscale import d1 for Cloudflare D1 offline migration#1278
Open
no-itsbackpack wants to merge 6 commits into
Open
Add pscale import d1 for Cloudflare D1 offline migration#1278no-itsbackpack wants to merge 6 commits into
no-itsbackpack wants to merge 6 commits into
Conversation
Introduces the D1 import command group with lint, plan, pgloader-based load, and verify, plus slim postgres connection helpers shared by the import path. Co-authored-by: Cursor <cursoragent@cursor.com>
Use fmt.Fprintf instead of WriteString with Sprintf or concatenation to satisfy QF1012 and writestring checks. Co-authored-by: Cursor <cursoragent@cursor.com>
Unify JSON/human exit codes for status:error responses, populate lint error envelopes, and format affected Go sources with go fmt. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 270bceb. Configure here.
Defer .read batch splits until a line completes a statement so multi-line CREATE TABLE blocks are never cut mid-statement on large exports. Co-authored-by: Cursor <cursoragent@cursor.com>
Validate migration state before pgloader when --migration-id is set so state errors surface even when pgloader is missing locally. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds
pscale import d1— an offline migration path from Cloudflare D1 (SQLite export) into PlanetScale Postgres.doctor,export,lint,convert-schema,start(lint + plan;--dry-runpreview),verify,status,complete/teardowninternal/migrate/d1/— schema conversion, lint/plan, pgloader + small-table import paths, verify, migration stateinternal/postgres/— connection URI parsing, pgx open, psql discovery/version check only (no logical replication / pg_dump pipeline)internal/migrate/d1/,test_import_d1.sh, andscript/d1-import-test/for local e2e/benchmarksThis PR is intentionally scoped to D1 only. It does not include the postgres branch logical-replication import work from
add-postgres-branch-imports.Test plan
go test ./internal/migrate/d1/...pscale import d1 doctor,pscale import d1 start --dry-runagainst a D1 export