Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request vitessio#4696 from dweitzman/preflight_fk
Browse files Browse the repository at this point in the history
Disable foreign key checks when preparing existing schema for preflight schema change tests
  • Loading branch information
morgo authored May 27, 2020
2 parents 783474f + 9778957 commit 33b03b7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions go/vt/mysqlctl/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ func (mysqld *Mysqld) PreflightSchemaChange(dbName string, changes []string) ([]
initialCopySQL += "DROP DATABASE IF EXISTS _vt_preflight;\n"
initialCopySQL += "CREATE DATABASE _vt_preflight;\n"
initialCopySQL += "USE _vt_preflight;\n"
// We're not smart enough to create the tables in a foreign-key-compatible way,
// so we temporarily disable foreign key checks while adding the existing tables.
initialCopySQL += "SET foreign_key_checks = 0;\n"
for _, td := range originalSchema.TableDefinitions {
if td.Type == tmutils.TableBaseTable {
initialCopySQL += td.Schema + ";\n"
Expand Down

0 comments on commit 33b03b7

Please sign in to comment.