Got it.
Actually it's not correctly explained in the slides, maybe because
it's quite new?

Anyway here is how it works:
- generate-migrations-db: creates the migration files from the
beginning. So useless if you don't want to drop and re-create the db.
- generate-migrations-models: same thing, but from the models
- generate-migrations-diff: make the diff between the models and the
schema yml files. So as Florian explained, be careful to not build the
models before doing the diff.

But there's the other solution I was looking for: make your own task
with Doctrine_Core::generateMigrationsFromDiff like this:
- Doctrine_Core::generateMigrationsFromDiff('/path/to/migration/
classes', 'doctrine_db_connection_name', '/path/to/schema.yml');

Then the migrations classes will be created, even if your models and
schema are the same, as long as the db is different from the schema!

Guill


On Mar 5, 10:36 am, godbout <guillaume.lecler...@gmail.com> wrote:
> Hi Florian!
>
> Thx for the help.
> Yah, you're right, I meant 'generate-migrations-diff'. Was a bit tired
> from the day probably :-p
> Yah, also I got the flow. Actually I think I've found why it didn't
> work, there's an error in the yml file (found when I've tried to build
> the classes anyway).
>
> But it still very blur on the generate-migrations-db and generate-
> migrations-models. Is there any comparison made between the db and the
> yml? Or it is just taking db, or the model, and produce a pile of file
> that just helps you to re-create the db?
>
> Guill
>
> On Mar 5, 4:39 am, Florian <sideral.undergro...@gmail.com> wrote:
>
>
>
> > hi,
>
> > you surely wanted to say 'generate-migrations-diff' in your third
> > try ?
>
> > The "doctrine:generate-migrations-diff" task calculates the difference
> > between your model classes and the yml schema.
>
> > So when you want to modify your model, do this in *this exact order* :
>
> >  - make sure your model is up to date before modifying your schema by
> > calling: "php symfony doctrine:build --all-classes --sql"
> >  - modify your schema.yml with whatever you want
> >  - run "php symfony doctrine:generate-migrations-diff"
> >  - look at your lib/migration/doctrine folder if everything gone fine
>
> > If you build your model before calling "doctrine:generate-migrations-
> > diff", doctrine won't know what has changed and will do nothing.
>
> > Hope it helps!
>
> > Florian
>
> > On 4 mar, 14:38,godbout<guillaume.lecler...@gmail.com> wrote:
>
> > > Hi guys.
>
> > > I want to use the symfony tasks for the doctrine migration but I can't
> > > find any consistent piece of information.
>
> > > I read this:
> > > -http://www.doctrine-project.org/documentation/manual/1_2/en/migrations
> > > and this:
> > > -http://www.symfony-project.org/reference/1_4/en/16-Tasks#chapter_16_s...
> > > and I've watched these slides:
> > > -http://www.slideshare.net/weaverryan/the-art-of-doctrine-migrations
> > > and those ones:
> > > -http://www.slideshare.net/denderello/symfony-live-2010-using-doctrine...
>
> > > Sometimes it says that the generate-migrations-db will make a
> > > comparison between the db and the schema.yml and generate the classes,
> > > sometimes it says that it will just take the db and make the classes.
> > > I don't see the point of the second information, but this is what
> > > happens for me. Whatever is in the schema.yml is not taken in
> > > consideration, and I end up with migration classes that just create
> > > the same db that I have and not the updates from my yml files.
>
> > > Same thing for generate-migrations-models. My models are the same than
> > > the db, but not than the yml files. But whatever, the migration
> > > classes just a copy of the model and doesn't pay attention to the yml
> > > files.
>
> > > I've tried the last one: generate-migrations-models. According to some
> > > of the links it actually does the difference between the yml files and
> > > the model (well, on some other links it's the definition of the
> > > generate-migrations-models function, so I don't get it...). I can't
> > > really see the model because it lamentably failed with a ToPrfx...
> > > something class not found.
>
> > > Anybody to lighten me up on that?
>
> > > Cheers in advance,
> > > Guill

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to