Question

I'm setting up a brand-new Rails 4.1 app and using 64-bit PostgreSQL 9.3.4 as my development server. Everything goes smoothly until I run rake db:migrate. Nothing happens. I ran the command again with the --trace flag, and it looks like the app is not processing my migrations and finishes without error:

rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:schema:dump

The migrations are basic stuff like a User table. Some are auto-generated by the Comfortable Mexican Sofa gem, and some are my own extracted from another Rails 4 app.

When I run rake db:migrate:status it shows all of my migrations as down/pending:

 Status   Migration ID    Migration Name
--------------------------------------------------
  down    20120117051823  Create sessions table
  down    20120117051824  Create users
  down    20120117051910  Create categories
  down    20120117051947  Create statuses
  down    20120117052044  Create settings
  down    20120117052336  Create roles
  down    20120117053039  Create emails
  down    20120117053111  Create urls
  down    20120117053152  Create pictures
  down    20120117053441  Create addresses
  down    20120117053516  Create phones
  down    20120117053716  Create notes
  down    20120117053849  Create announcements
  down    20120117054118  Create contacts
  down    20120117060145  Users have and belong to many roles
  down    20121018184843  Create translations
  down    20140407233039  Create cms

I can run rake db:create and rake db:drop without issue, which confirms that I have proper access rights to the PostgreSQL server.

I tried using SQLite in place of PostgreSQL, but I get the same issue: it creates development.sqlite and test.sqlite just fine, but doesn't populate them. I eliminated things like access rights, writable files/directories, etc. I even tried setting up a new PostgreSQL server and had the same issue. Also, my old Rails 3 and Rails 4 apps that are connecting to the same server run just fine.

I also tried setting up an app using RailsComposer in case my template was the problem, but I ran into the same issue.

According to some Stack Overflow answers other people have had the same issue when using Devise and CanCan, but I don't use either one: I use Authlogic as my authentication system and Pundit as my authorization system.

What might be causing this issue?

UPDATE

OK, my code works with both PostgreSQL and SQLite if I run it on 64-bit Windows 7 system using Ruby 1.9.3. But, it still doesn't work on my dev box running 64-bit Debian 7 with Ruby 2.1.1 or Ruby 2.0.0. (Note: I'm running rbenv.)

UPDATE 2

rake db:schema:load works on both Windows and my Debian machine. Only rake db:migrate is not working.

Was it helpful?

Solution

Just to close this question for posterity: I think the problem was with the virtual machine. I ended switching to a Debian 7.6 using vagrant and the problem went away.

Specifically I think it had to so how the underlying file system was mapped from linux guest to Windows host.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top