Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatabaseRewrites Config option to rename schema is incorrect #216

Open
NatMorcos opened this issue Oct 8, 2020 · 0 comments
Open

DatabaseRewrites Config option to rename schema is incorrect #216

NatMorcos opened this issue Oct 8, 2020 · 0 comments

Comments

@NatMorcos
Copy link

The Config suggests a top level option in the .json file passed into the ghostferry-copydb process on initialization:

ghostferry/config.go

Lines 355 to 361 in 5f71469

// Map database name on the source database (key of the map) to a
// different name on the target database (value of the associated key).
// This allows one to move data and change the database name in the
// process.
//
// Optional: defaults to empty map/no rewrites
DatabaseRewrites map[string]string

However, this is incorrect. This option is never accessed. The copydb process expects a nested option inside a top level Database key:

// Allows database/tables to be renamed from source to the target, where the
// key of this map is the database/table names on the source database and the
// value of the map is on the database/table names target database.
Rewrites map[string]string

A successful config file using this option should look like

# Good

{
  "Source": { ...  },
  "Target": { ...  },
  "Databases": {
     # ...
    "Rewrites": {
      "old_schema_name": "new_target_schema_name"
    }
  },
  "Tables": { ... },
  # Other top level options
}

The documentation + the /config.go file suggest

# Bad

{
  "Source": { ...  },
  "Target": { ...  },
  "Databases": { ...  },
  "Tables": { ... },
  "DatabaseRewrites: {
      "old_schema_name": "new_target_schema_name"
    },
  # Other top level options
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant