0

On my Mac, my Rails project is using SQLite3 with a 64-character index name. I need to work on it in an Ubuntu environment. However, when I try to run rake db:setup, I get an error that my 64-character named index is too long, that SQLite3 only supports up to 62 characters for an index name.

So I figure I'll create a migration to shorten the name of that index. But when I run rake db:setup again, I just get the same error as that new migration isn't yet run.

How can I reduce the length of that index name?

at.
  • 50,922
  • 104
  • 292
  • 461
  • `rake db:setup` will load the database structure from the schema, which won't include your shortened index name migration. Not certain on this but you should be able to run `rake db:create`, then `rake db:migrate` to run all the migrations which should give you all the empty tables and run your shortened index name migration then `rake db:seed` if you have any seed data. – j-dexx Sep 16 '14 at 08:27
  • @japed the create won't work as rails can't create the 64 character named index – at. Sep 16 '14 at 14:47
  • In which case can you set the index name in the migration that creates the table rather than as a separate migration – j-dexx Sep 16 '14 at 14:57
  • The migrations won't run. I understand it's very much discouraged to alter old migrations as well – at. Sep 16 '14 at 16:42
  • It is discouraged but you're setting up a new database right? So they've not run. You're always going to run into this problem on your new database unless you change the index name on the old database to change the schema and run `rake db:schema` – j-dexx Sep 19 '14 at 09:17

0 Answers0