Forum: Ruby on Rails Migrations in current dir, not RAILS_ROOT

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 pergesu (Guest)
on 2005-11-15 11:43
(Received via mailing list)
I'm playing around with engines, and want to see if I can get
migrations working with them.  According to rake --tasks, the migrate
task will "migrate the database according to the migrate scripts in
db/migrate (only supported on PG/MySQL)."  I assumed it would just
look in the current dir for db/migrate, but it doesn't seem to be.
Here's the layout of my app:
myproject
|- db
    |- migrate
|- vendor
    |- plugins
         |- myengine
              |- db
                  |- migrate

if I cd to vendor/plugins/myengine and run "rake migrate", it ignores
the files in ./db/migrate.  However if I copy them up to
myproject/db/migrate, it finds them fine.  So my first question is how
does rake know to use RAILS_ROOT to begin with?  I don't see any
reason why it wouldn't act in the current directory.  Second, how do I
get it to run migrate on the migrations beneath the current directory?

Thanks,
Pat
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 james.adam (Guest)
on 2005-11-15 12:14
(Received via mailing list)
Running migrations from external code sources is going to involve a
LOT of trust. I can see how the workflow might ideally be very
convenient, but I would *strongly* suggest that it's better for you to
have all of the migrations stuff under your total control.

It's not that I'm saying you absolutely shouldn't... just that when
you're actually talking about your DB, the precious data in the middle
of your Totally Sweet Rails App, I wouldn't trust *anyone* to screw
around with the schema at all.

In other words, the DB schema provided with engines should only really
be used for bootstrapping and for reference, and manually integrating
it with your existing migrations will probably make your life much
easier in the long-term. DB schemas shouldn't change between minor
versions of engines (or any code that is in beta), so if you stick to
a single release of, say, the login engine, you shouldn't have to deal
with schema changes, ever (oh, for an ideal world...).

- james
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 pergesu (Guest)
on 2005-11-15 12:29
(Received via mailing list)
I was thinking more like using migrations to manage the database as
the app progresses...but if I'm just working on the engine, then
obviously I don't need to upgrade any schemas, so I'm free to just
wipe the db as necessary.
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 james.adam (Guest)
on 2005-11-17 10:47
(Received via mailing list)
Pat, you might want to check out the migrations stuff that I just
added to the developer branch of Engines; I posted to the list
yesterday about it. Very much inspired by your conversation on IRC :)

- james
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 pergesu (Guest)
on 2005-11-17 11:11
(Received via mailing list)
I saw the announcement, thanks for putting it up.  That wasn't you I
was talking with, was it?  I'd feel pretty stupid referring to "James
Adam" if I was speaking with you :)

Anyway I'll mess around with it, see if there are any problems.

Any clue about the problem with the LoginEngine not rolling back
changes when an email can't be delivered?  I spent a long time trying
to figure out why that test was failing and am just stumped.

Pat
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 james.adam (Guest)
on 2005-11-17 11:29
(Received via mailing list)
I'm "lazyat0m", normally, so no - I was lurking ;)

I'm still stumped by that issue - when I try working with it in the
console, the roll-back happens, but it just never seems to work when
testing! :-S

- james
This topic is locked and can not be replied to.