• Email
  • Like
  • Save
  • Private Content
  • Embed
 

The Art of Doctrine Migrations

by

  • 15,891 views

Doctrine Migrations presentation from the nasvhille symfony user group - February 2010

Doctrine Migrations presentation from the nasvhille symfony user group - February 2010

Accessibility

Categories

Upload Details

Uploaded via SlideShare as Adobe PDF

Usage Rights

© All Rights Reserved

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel

8 Embeds 1,506

http://www.symfonylab.com 1230
http://gpupo.com 145
http://www.slideshare.net 107
http://coderwall.com 10
http://www.techgig.com 9
http://www.linkedin.com 3
http://paper.li 1
http://www.sfexception.com 1

More...

Statistics

Likes
13
Downloads
156
Comments
9
Embed Views
1,506
Views on SlideShare
14,385
Total Views
15,891

19 of 9 previous next Post a comment

  • weaverryan Ryan Weaver, Symfony Developer at KnpLabs @beachDefender-

    I don't exactly what problem you're getting at, but I do know that there are definitely issues with Doctrine1 (and Doctrine1's migrations) related to the naming of things, how versions are tracked etc. In fact, the importance of this presentation is really to highlight how you can use a system that's far from perfect to solve a problem.

    The better answer is this: Symfony2 and Doctrine2 are different. The Doctrine migrations now exist as a standalone library from the Doctrine community and - while not yet stable - is very well done (the design takes a lot from other languages and how they solve the problem of migrations). Symfony2 is much the same way - nothing is imposed on you and where there *are* standards, they exist only for convenience and you're free to use whatever standard you want.

    So, if you're frustrated by some issues or conventions with Doctrine1 or symfony1, I'd encourage you to have a look at Doctrine2 and Symfony2 - a lot of work has been done to learn from the first versions.

    And if I totally missed your question/comment, let me know :)
    2 years ago
    Are you sure you want to
  • beachDefender beachDefender Why have you done so little to use scope rather than naming conventions to avoid conflict? There is simply no good reason that I cant have a table name the same as an index name as a column name as a foreign key.

    To rely on something as fickle and abstract as a naming convention rather than scope to avoid conflict essentially renders the application useless as a serious, enterprise building tool.

    I am not encouraged by the insistence in both Doctrine and Symfony on this approach. It might work for small, simple databases and systems but basing internal structures based on a name rather than a definition is a really bad design choice.

    You throw out all the flexibility of underlying systems and make it almost impossible to build large multi application environment effectively and efficiently.

    Each of the components in the layer - RDBMS, PHP, and even the file system, understand scope, none of them care about naming.
    2 years ago
    Are you sure you want to
  • guest1ec9c0 Marco Bernasocchi, Owner at bernawebdesign.ch hey Ryan, so i changed my deploy scripts, but i still have a problem. from my staging server where i do generate the migratons-diff I do:

    - ssh prodserver symfony project:disable prod
    - symfony project:deploy prod --go
    - ssh prodserver symfony doctrine:migrate --env=prod
    - ssh prodserver symfony project:clear-controllers
    - ssh prodserver symfony project:permissions
    - ssh prodserver symfony project:enable prod

    the only problem is that when i do the doctrine:migrate i get the temporary unavailable page. i launch my commands like this:
    - ssh produser@localhost ’~/website.com/symfony project:enable prod’ thanks a lot
    3 years ago
    Are you sure you want to
  • guest1ec9c0 Marco Bernasocchi, Owner at bernawebdesign.ch Ok I see, thanks. So i'll generate the migration classes on my staging server and then deploy to production.

    thanks a lot again
    3 years ago
    Are you sure you want to
  • weaverryan Ryan Weaver, Symfony Developer at KnpLabs It's even more to make sure that you didn't forget to generate any migrations. For example, suppose you added a column and then regenerated your model. You then add another column, run the diff tool (as you should) and then regenerate the model. The generated diff will only contain the second column you added - there will be no migration for the first. Using the mysql diff tool is a low-level way to detect if you missed anything. 3 years ago
    Are you sure you want to
  • guest1ec9c0 Marco Bernasocchi, Owner at bernawebdesign.ch yeah, that makes sense, thanks a lot, just one more question, you say '- Locally: test using mysqldiff to make sure your database schema is up to date' is it just to double check that the local doctrine:migrate after the generate-migrations-diff (you do run a doctrine:migrate on the local machine before deploy, right?) worked as expected?
    thanks again
    3 years ago
    Are you sure you want to
  • weaverryan Ryan Weaver, Symfony Developer at KnpLabs @Marco: This is close, but not exactly what I would recommend. The migrations should all be generated locally (and tested) and then pushed up with the rest of your changes. A full deployment might look like this:

    - Locally: symfony doctrine:generate-migrations-diff
    - Locally: test using mysqldiff to make sure your database schema is up to date
    - Production: symfony project:disable prod
    - Locally: deploy all of your changes (including your new migration files) to productio
    - Production: symfony doctrine:migrate
    - Production: project:enable prod


    I hope this helps. Your site only needs to be down during the migration itself.
    3 years ago
    Are you sure you want to
  • guest1ec9c0 Marco Bernasocchi, Owner at bernawebdesign.ch hi, thanks a lo, how do you integrate migrations with the project:disable / project:enable tasks?

    as in
    symfony project:disable prod
    symfony doctrine:generate-migrations-diff
    symfony doctrine:migrate
    symfony project:enable prod

    doing this gets the site unavailable page when doing the diff and the migration task
    3 years ago
    Are you sure you want to
  • kazuhirohiramatsu Kazuhiro Hiramatsu, software developer at none Great introduction into Doctrine migrations. 3 years ago
    Are you sure you want to
Post Comment
Edit your comment

The Art of Doctrine Migrations The Art of Doctrine Migrations Presentation Transcript