Skip to content

cli/cmd/sync_v2.go: WithRemovePKs() called twice instead of WithRemovePKs() + WithRemoveUniqueConstraints() #23167

Description

@praneshnikhar

CLI: Wrong transformer option in cli/cmd/sync_v2.go

File: cli/cmd/sync_v2.go:34

Problem: In the v2→v3 append-mode path, WithRemovePKs() is called twice instead of WithRemovePKs() + WithRemoveUniqueConstraints(). This means unique constraints are silently preserved when they should be removed to match v3's schema expectations.

Current code:

opts = append(opts, transformer.WithRemovePKs(), transformer.WithRemovePKs())

Expected:

opts = append(opts, transformer.WithRemovePKs())
opts = append(opts, transformer.WithRemoveUniqueConstraints())

Fix: Replace the duplicate WithRemovePKs() call with WithRemoveUniqueConstraints().

Reproduction

  1. Configure a v2 source plugin with a v3 destination in append mode (via v2-to-v3 migration path).
  2. Run sync — unique constraints from v2 tables are preserved in the destination.
  3. These constraints can cause conflicts/errors on subsequent writes since v3 destinations don't expect them.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions