Sha256: 033752de235986b08e032f6c9d44388ee12de28e4d146bc5b8947b0461a63898

Contents?: true

Size: 939 Bytes

Versions: 123

Compression:

Stored size: 939 Bytes

Contents

class AddTaskCreatedAt < ActiveRecord::Migration
  def self.up
    add_column :tasks, :created_at, :datetime
    Task.find(:all).each do |task|
      task.created_at = task.period.start_on
      task.save
    end
    remove_column :tasks, :estimate
    remove_column :tasks, :assigned_to
    change_column :tasks, :initial_estimate, :decimal, :precision => 6, :scale => 2, :null => false
    change_column :works, :todo, :decimal, :precision => 6, :scale => 2, :null => false, :default => 1
    change_column :works, :hours, :decimal, :precision => 6, :scale => 2, :null => false, :default => 0
  end

  def self.down
    remove_column :tasks, :created_at
    add_column :tasks, :estimate, :time
    add_column :tasks, :assigned_to, :integer
    change_column :tasks, :initial_estimate, :integer, :null => false
    change_column :works, :todo, :integer, :null => false
    change_column :works, :hours, :integer, :null => false
  end
end

Version data entries

123 entries across 123 versions & 1 rubygems

Version Path
backlog-0.17.3 db/migrate/007_add_task_created_at.rb
backlog-0.17.5 db/migrate/007_add_task_created_at.rb
backlog-0.18.0 db/migrate/007_add_task_created_at.rb
backlog-0.17.6 db/migrate/007_add_task_created_at.rb
backlog-0.19.0 db/migrate/007_add_task_created_at.rb
backlog-0.2.0 db/migrate/007_add_task_created_at.rb
backlog-0.2.1 db/migrate/007_add_task_created_at.rb
backlog-0.20.0 db/migrate/007_add_task_created_at.rb
backlog-0.20.1 db/migrate/007_add_task_created_at.rb
backlog-0.21.0 db/migrate/007_add_task_created_at.rb
backlog-0.21.2 db/migrate/007_add_task_created_at.rb
backlog-0.21.1 db/migrate/007_add_task_created_at.rb
backlog-0.21.3 db/migrate/007_add_task_created_at.rb
backlog-0.22.0 db/migrate/007_add_task_created_at.rb
backlog-0.22.1 db/migrate/007_add_task_created_at.rb
backlog-0.23.0 db/migrate/007_add_task_created_at.rb
backlog-0.23.1 db/migrate/007_add_task_created_at.rb
backlog-0.24.0 db/migrate/007_add_task_created_at.rb
backlog-0.25.0 db/migrate/007_add_task_created_at.rb
backlog-0.26.0 db/migrate/007_add_task_created_at.rb