Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在构建一个 Rails 3.2.6 应用程序,我需要在已创建的名为 tasks 的表上的列中添加一个默认值。我如何通过迁移来做到这一点?
谢谢!
使用change_column(table_name, column_name, type, options = {}):
change_column(table_name, column_name, type, options = {})
def up change_column :tasks, :my_column, :integer, :default => 1 end