Add --drop_constraints to MoveTables#9904
Add --drop_constraints to MoveTables#9904rohit-nayak-ps merged 1 commit intovitessio:mainfrom Phanatic:move-tables-drop-constraints
--drop_constraints to MoveTables#9904Conversation
Signed-off-by: Phani Raj <phani@planetscale.com>
|
Sorry, I was a bit late here... if it's not too late we should change this to be more specific. There are currently two types of constraints:
I don't think we'd ever want to strip the second and this has some potential for confusion. |
This underlying feature was added in #6422, only to Materialize, where the primary aim was to drop foreign key constraints, but it does just drop all constraints. This PR is just exposing that same feature in MoveTables.
Since Check Constraints was properly implemented in a recent version of MySQL (at the time of original PR), it may not have been considered. I agree we will probably never need to drop check constraints in a workflow, since it is essentially a row level validation scoped to the same table. @Phanatic, does this sound good: dropping constraints will be scoped only to foreign key constraints? If you like I can work on a follow-up PR. |
Description
This PR adds a
drop_constraintsswitch toMoveTableswhich will allow us to automatically strip constraints on tables in the target keyspace when importing a database into Vitess.Setting this to true causes us to use the
createDDLAsCopyDropConstraintcreate DDL mode, which will strip all constraints from the table before creating it in Vitess.https://github.com/vitessio/vitess/blob/6fce6c66899dbd593e5d4e80ce7d2ff95046e13f/go/vt/wrangler/materializer.go#L1034-L1041
Checklist