Rails migrations: Undo default setting for a column

I have the problem, that I have an migration in Rails that sets up a default setting for a column, like this example: def self.up add_column :column_name, :bought_at, :datetime, :default => Time.now end Suppose, I like to drop that default settings in a later migration, how do I do that with using rails migrations? My … Read more

Add a reference column migration in Rails 4

A user has many uploads. I want to add a column to the uploads table that references the user. What should the migration look like? Here is what I have. I’m not sure if I should use (1) :user_id, :int or (2) :user, :references. I’m not even sure if (2) works. Just trying to do … Read more