Activerecord Migration Not Executing
I am new to rails, and created a custom migration to change my database structure using Rails Generate. Here is the command I issued: rails g migration users. Now, in the file it c
Solution 1:
It's not running at all? It's hard to say based on the info you gave. Perhaps you should try a migration with a more unique name? Something like:
rails g migration ConvertUsersNamesToSingleField
I'm not sure if it's cool to have two migrations with the same name. But with short generic names like Users that might be the problem here. And it usually can't hurt to have a verbose and descriptive migration name, for posterity and clarity.
This questions agree that migration with non unique names don't work: Rails migrations with the same name
But even when ran, this will raise errors. You need to include table names in those column calls, and you need to specify a type when creating fields.
classConvertUsersNamesToSingleField < ActiveRecord::Migrationdefchange
add_column :users, :first_name, :string
add_column :users, :last_name, :string
remove_column :users, :nameendend
Post a Comment for "Activerecord Migration Not Executing"