Skip to content

Commit cfed4ad

Browse files
committed
added force plus turned off foreign key constraints
1 parent fecb1de commit cfed4ad

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bin/mysqlnaga-sync

100644100755
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ sub process_db {
9898
verbose("\tLOADER-LOG.txt gone");
9999
}
100100

101-
verbose("Finished with database '${DB}'");
101+
verbose("Finished with database '${DB}'");
102102

103103
return;
104104
}
@@ -151,6 +151,11 @@ sub _process_table {
151151
$drop_table = $src ne $trg ;
152152
$populate_table = $drop_table;
153153
}
154+
#Populate always
155+
elsif($OPTIONS->{force}) {
156+
$drop_table = 1;
157+
$populate_table = 1;
158+
}
154159
else {
155160
die 'You have not said how to compare these schemas. Check the help';
156161
}
@@ -274,6 +279,7 @@ sub _parse_options {
274279
directory=s
275280
database=s
276281
disable-foreign-keys
282+
force
277283
host=s
278284
no-dump
279285
no-views
@@ -354,6 +360,7 @@ sub _open_dbh {
354360
);
355361
my $dsn = "DBI:mysql:database=${db}${hostname}${port}";
356362
my $dbh = DBI->connect($dsn, $user, $password, {RaiseError => 1});
363+
$dbh->do("SET FOREIGN_KEY_CHECKS = 0");
357364
return $dbh;
358365
}
359366

0 commit comments

Comments
 (0)