0

I have a Rails migration that looks like this:

puts "*** What would you like to do? ***"
puts "(a)dd columns AND copy data"
puts "(c)olumns only (no data copying)"
puts "(d)ata only (no column adding)"
puts "(q)uit"
reply = $stdin.gets.chomp
...
(subsequent code depends on the reply variable)

This works on my development system.

Heroku isn't accepting my response when I type a letter, after it gives me the above text as a prompt.

How can I get this to work on Heroku?

sscirrus
  • 55,407
  • 41
  • 135
  • 228
  • This seems to get away from the main promise of migrations; that they're records of exactly what's happened to your database schema. If you accept input during a migration to decide what to do, you'll have no way to track it later down the line. Why do you need this? – Anthony Bishopric Jun 09 '12 at 03:05
  • @AnthonyBishopric This migration changes the way the website handles one of its major features (data is moved from one suite of database tables to another). In our production system, data has to be transferred over instantaneously with the migration's database changes, so we allow for that data transfer with this migration. – sscirrus Jun 09 '12 at 04:42
  • @AnthonyBishopric The other thing is that if this migration ever has to be redone, rolled back, etc., having the choice to change the database only, or to recopy the information only, is really important, otherwise data might be lost or corrupted. – sscirrus Jun 09 '12 at 04:53

1 Answers1

0

Instead of running

heroku rake db:migrate

run:

heroku run bash

then you can run interactive migrations.

sscirrus
  • 55,407
  • 41
  • 135
  • 228