mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
10 lines
368 B
Ruby
10 lines
368 B
Ruby
class AddUpdatedAtToTodos < ActiveRecord::Migration[5.2]
|
|
def self.up
|
|
add_column :todos, :updated_at, :timestamp
|
|
execute 'update todos set updated_at = created_at where completed_at IS NULL'
|
|
execute 'update todos set updated_at = completed_at where NOT (completed_at IS NULL)'
|
|
end
|
|
def self.down
|
|
remove_column :todos, :updated_at
|
|
end
|
|
end
|