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.37.2 db/migrate/007_add_task_created_at.rb
backlog-0.37.1 db/migrate/007_add_task_created_at.rb
backlog-0.36.2 db/migrate/007_add_task_created_at.rb
backlog-0.0.0 db/migrate/007_add_task_created_at.rb
backlog-0.0.1 db/migrate/007_add_task_created_at.rb
backlog-0.0.2 db/migrate/007_add_task_created_at.rb
backlog-0.0.5 db/migrate/007_add_task_created_at.rb
backlog-0.0.4 db/migrate/007_add_task_created_at.rb
backlog-0.1.1 db/migrate/007_add_task_created_at.rb
backlog-0.1.0 db/migrate/007_add_task_created_at.rb
backlog-0.1.2 db/migrate/007_add_task_created_at.rb
backlog-0.10.0 db/migrate/007_add_task_created_at.rb
backlog-0.10.1 db/migrate/007_add_task_created_at.rb
backlog-0.10.2 db/migrate/007_add_task_created_at.rb
backlog-0.10.3 db/migrate/007_add_task_created_at.rb
backlog-0.10.4 db/migrate/007_add_task_created_at.rb
backlog-0.10.5 db/migrate/007_add_task_created_at.rb
backlog-0.10.6 db/migrate/007_add_task_created_at.rb
backlog-0.10.7 db/migrate/007_add_task_created_at.rb
backlog-0.12.0 db/migrate/007_add_task_created_at.rb