migration problems

Hi, I got stuck on a migration (basically to fix a column name). I actually went into the table itself and corrected the problem. My herkou migration gets stuck, and I’ve got other migrations behind it that aren’t running.

What should I do?

Thanks,

Joe

Can you share some code? There are more changes to receive help that way.

Hi, I got stuck on a migration (basically to fix a column name). I
actually went into the table itself and corrected the problem. My herkou
migration gets stuck, and I've got other migrations behind it that aren't
running.

If you've already fixed the table manually, then you don't need to run the
migration at all. You have 3 hackish options

1. Just delete the migration and update the old migration so it uses the
correct column name.
2. Insert the timestamp of the migration that you want to skip to a table
called schema_migrations (not sure if this is
the exact name). Rails basically checks this table to see which migrations
need to run.
3. Edit the migration so that it doesn't do anything, commit, deploy, run
db:migrate. Edit the migration again, commit,
deploy, run db:migrate. The second db:migrate should not run the edited
migration file.

May I ask why you decided to fix the table manually?

ok, I’m having difficulty with heroku, they are having some build problems…

I’ll try later. I guess commenting out the # rename table in change def should work?

I was puzzled because the column title started with a capital letter, it worked fine in sqlite, but generated errors in postgres. (so the quickest fix for me was to edit the column in postgress directly). I belive I skipped this migration before, but I forget how I did that.

Thanks,

Joe

ok, I'm having difficulty with heroku, they are having some build
problems...

I'll try later. I guess commenting out the # rename table in change def
should work?

I was puzzled because the column title started with a capital letter, it
worked fine in sqlite, but generated errors in postgres. (so the quickest
fix for me was to edit the column in postgress directly). I belive
I skipped this migration before, but I forget how I did that.

is there anything that keeps you from using postgres for development?

Got it working. I was just using the default settings that ror. It’s much easier to deal with sqlite in development. I hate using PGAdmin for postgres.

Thanks,

Joe

Got it working. I was just using the default settings that ror. It's much
easier to deal with sqlite in development. I hate using PGAdmin for
postgres.

Why do you have to use pgadmin? You should very rarely have to go
direct to the database.

Colin

oh, right. Just to do some minor things, but with pgadmin you have to write a bunch of sql.

What sort of minor things? Often you can do things from the rails console.