Search code examples
ruby-on-railspostgresqldatabase-migrationrails-migrations

What does "0 rows" mean when running a Rails migration?


I just ran a migration that adds several indexes to several tables. Every single one results in this "-> 0 rows" output:

Migrating to AddVariousIndexesOctober2014 (20141103195036)
== 20141103195036 AddVariousIndexesOctober2014: migrating =====================
-- add_index(:foo, [:bar, :baz])
   -> 0.0240s
   -> 0 rows
…

I don't remember ever seeing something like this before.

Inspecting the database, the data is non-zero as expected and the index additions seem to have worked as expected.

what does "-> 0 rows" mean?


Solution

  • Adding an index to a table doesn't change any rows in the table, so it's normal to see 0 rows here. If you changed a column, then you would see a non-zero number, since this would affect all rows in the table.