Erm, so maybe the most appropriate ("sane") thing to do at that point would be to figure out *why* you're (apparently) repeating a migration that's already been done?
Just sayin' ...
Erm, so maybe the most appropriate ("sane") thing to do at that point would be to figure out *why* you're (apparently) repeating a migration that's already been done?
Just sayin' ...
Hassan Schroeder wrote:
because most sane people would want to preserve the contents of an existing db when they modify it.
Erm, so maybe the most appropriate ("sane") thing to do at that point would be to figure out *why* you're (apparently) repeating a migration that's already been done?
There was an existing database, yes, I thought that was clear. The reason I did it again was (also clear if you can read, but to repeat) because I wanted to move the session store to Active Record so I was following this instruction:
You need to create the session table as below rake db:sessions:create rake db:migrate
Which I am grateful for that advice, because it worked; but I did have to create the db manually (because I want it populated, and already have a script to do that), add the session table myself (to the aforementioned script), and insert it back in. So I guess I don't get the point of the migration thing yet: is it more for people who don't want to create a db themself, or what?
Nb, this is my second casual week using rails. If all I want to do is add a table to the database, why would it want to rebuild the whole thing, ie, why not just add the new table and leave the existing tables alone? I presume there is away to do this and I haven't read enough of the API docs yet. Is this going against "the convention", hence I needed to do some more "configuration"?
There was an existing database, yes, I thought that was clear. The reason I did it again was
Yes, yes, entirely clear, and totally irrelevant to the issue.
Which I am grateful for that advice, because it worked; but I did have to create the db manually (because I want it populated, and already have a script to do that), add the session table myself (to the aforementioned script), and insert it back in.
No, you didn't - that's the whole point
So I guess I don't get the point of the migration thing yet:
Apparently -- so, seriously, read up on migrations before you go any further. You'll save yourself a lot of headaches down the road.
Hassan Schroeder wrote:
nothing of interest to me either
Thanks for your non-advice!
Where did I say that? Must be some cross-talk in your mail client
Mk 27 wrote:
Hassan Schroeder wrote:
nothing of interest to me either
Thanks for your non-advice!
Hassan gave you some excellent advice. Read it again -- and this time, if you want to learn, I suggest that you ask instead of hurling insults. (I also suggest that an apology to Hassan might be in order, but that's between you and him.)
Best,
Hassan Schroeder wrote:
because most sane people would want to preserve the contents of an
existing db when they modify it.
Erm, so maybe the most appropriate (“sane”) thing to do at that
point would be to figure out why you’re (apparently) repeating a
migration that’s already been done?
There was an existing database, yes, I thought that was clear. The
reason I did it again was (also clear if you can read, but to repeat)
because I wanted to move the session store to Active Record so I was
following this instruction:
You need to create the session table as below
rake db:sessions:create
rake db:migrate
Which I am grateful for that advice, because it worked; but I did have
to create the db manually (because I want it populated, and already have
a script to do that), add the session table myself (to the
aforementioned script), and insert it back in. So I guess I don’t get
the point of the migration thing yet: is it more for people who don’t
want to create a db themself, or what?
Nb, this is my second casual week using rails. If all I want to do is
add a table to the database, why would it want to rebuild the whole
thing, ie, why not just add the new table and leave the existing tables
alone? I presume there is away to do this and I haven’t read enough of
the API docs yet.
You have hit the nail on the head here, that is exactly what migrations will do for you (ie “add the new table and leave the existing tables alone”) in addition to other things of course.
Colin