1

Trying to migrate a sqlite3 db for a rails app to mysql db. The column named "content" was a string type in sqlite3. I want to change it to varchar (or perhaps text) in mysql. I am not sure if there is a way to do this by using "ruby script/generate" command. Any ideas? Obviously, I could start all over again with desired column types but wondering if there is a better way.

tshepang
  • 12,111
  • 21
  • 91
  • 136
rst
  • 31
  • 2
  • 1
    I would really encourage you to use the migrations directly, as they are database-agnostic. You can easily run them against any database engine. – Joseph Weissman Oct 16 '10 at 23:33

1 Answers1

1

If you've defined your column type as a string in your schema, then it will already be a VARCHAR in mysql. If you want to change it to a text field, create a migration using something like script/generate Migration ChangeModelxContentToText and then use change_column to change it.

Peter Brown
  • 50,956
  • 18
  • 113
  • 146