-
Notifications
You must be signed in to change notification settings - Fork 115
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
Incorrect behavior when using "migration_diff" with "--plugin" option. #325
Comments
The main problem is that without some table prefixing for plugins it will be rather difficult to detect "new tables" vs "existing but not plugin related". There will either be too many or too less shown then.. |
Can't |
For normal purposes I agree. But what if you want to add this new SQL table into your plugin? Then you would want this one to be not excluded. |
I remember doing that in the first version of the command : only including tables from the db which have a |
Can't see why people wouldn't want that behavior since that's how snapshot works too. Anyway the behavior could have been made configurable. |
It still can. One would need to modify the |
Just to add some information, I tested including If I add a few testing lines to the
/**
* Process and prepare the data needed for the bake template to be generated.
*
* @return array
*/
public function templateData()
{
$connection = ConnectionManager::get($this->connection);
$options = [
'require-table' => true,
// Left out of this GitHub post for simplicity
//'require-table' => $this->params['require-table'],
'plugin' => $this->plugin
];
$tables = $this->getTablesToBake($connection->getSchemaCollection(), $options);
dd($tables);
$this->dumpSchema = $this->getDumpSchema();
$this->currentSchema = $this->getCurrentSchema();
$this->commonTables = array_intersect_key($this->currentSchema, $this->dumpSchema);
$this->calculateDiff();
return [
'data' => $this->templateData,
'dumpSchema' => $this->dumpSchema,
'currentSchema' => $this->currentSchema,
];
} Then run It does indeed dump an array of just the table names contained within the plugin |
PR welcome then. |
@ADmad Are you still interested in following up on this? |
My only follow up for now is I would like to get it addressed/fixed :) |
So whats the current consensus here, what can we do to address this? |
When using
migration_diff
with--plugin
option is creates migrations for all tables in the db instead of just the tables for which Table classes are present in the plugin. It would except it to only consider the tables of the plugin similar to howmigration_snapshot
does.The text was updated successfully, but these errors were encountered: