mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 07:10:12 +01:00
16 lines
422 B
Ruby
16 lines
422 B
Ruby
class AddSubclassAttrToTodos < ActiveRecord::Migration[5.2]
|
|
|
|
class Todo < ActiveRecord::Base; end
|
|
class Immediate < Todo; end
|
|
|
|
def self.up
|
|
add_column :todos, :type, :string, :null => false, :default => "Immediate"
|
|
add_column :todos, :show_from, :date
|
|
Todo.all.each { |todo| todo.type = "Immediate" }
|
|
end
|
|
|
|
def self.down
|
|
remove_column :todos, :type
|
|
remove_column :todos, :show_from
|
|
end
|
|
end
|