Skip to content

Commit

Permalink
Table name can be prefixed with connection name. If prefix is present…
Browse files Browse the repository at this point in the history
…, ensure it matches with current connection database name.
  • Loading branch information
Marko Kallio authored and HavokInspiration committed Feb 7, 2016
1 parent 88aa7d0 commit d049525
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Shell/Task/MigrationSnapshotTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,15 @@ public function fetchTableName($className, $pluginName = null)
$tables[] = $table->associations()->get($key)->_junctionTableName();
}
}
$tables[] = $table->table();
$t = $table->table();
$splitted = array_reverse(explode('.', $t));
if (isset($splitted[1])) {
$config = ConnectionManager::config($this->connection);
if ($config['database'] === $splitted[1]) {
$t = $splitted[0];
}
}
$tables[] = $t;

return $tables;
}
Expand Down

0 comments on commit d049525

Please sign in to comment.