idlDoctrineMigrationPlugin - 1.0.1
Doctrine migration made easy
You are currently browsing
the website for symfony 1
Two extra task to consolidate migration process model:diff and model:update
idlDoctrineMigrationPlugin provide two useful task to help managing your model migration.
This is specially useful when multiple developers works on the same project.
|David Jeanmonod||lead||hc.leadi TA divad|
Copyright (c) 2010 Idael Software
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
idlDoctrineMigrationPlugin provide two useful task to manage your model migration.
Doing the migration with the base doctrine tools is possible but could cause some problem, especialy when multiple developers work on the same project. Typical issues can be:
Using this plugin's tasks will help you to avoid those kind of problems.
$ symfony plugin:install idlDoctrineMigrationPlugin
The key concept around this plugin is to always perform model diff on schema.yml. Diff around database or model seems to be error prone, and as schema.yml is for most of us the main reference about the model, that's prefect.
So then the first task to use is:
$ symfony model:diff
When you change any schema.yml in your projet, or when you install a new plugin, run it. This task will generate the migration scripts to go from the previous schema.yml to the current one. If scripts have been generated, then current schema.yml is archived in /data/migration/history, and then can be reuse for next script generation. If there is not pending modifications, nothing is done. The first time you run the task, as there is no schema history, the generated migration script will contain all the database construction.
Once you have generate migration script, you need to update your model and database, for this call:
$ symfony model:update [--reload]
This task is safer than the traditional
doctrine:build tasks as it will execute the following actions:
By following this simple workfollow, and always updating the database or model using
model:update task, you will always have a coherent project state.
If you want to contribute please fell free to send your comment, and to share your pratices arround doctrine migration. We will be happy to complete this plugin according to your needs...