Sha256: 21b4437ae952405a03393596c0f9c858edd7e2046a4ee9184ad353c8ac84c2ee

Contents?: true

Size: 824 Bytes

Versions: 19

Compression:

Stored size: 824 Bytes

Contents

class AddIdsToQuestionnairesQuestions < ActiveRecord::Migration
  def up
    add_column qq_table, :id, :primary_key
    add_column qq_table, :position, :integer
    add_column qq_table, :created_at, :datetime
    add_column qq_table, :updated_at, :datetime

    execute "UPDATE #{qq_table} SET created_at = '#{Time.now.to_s(:db)}', updated_at = '#{Time.now.to_s(:db)}';"

    puts "=============================================="
    puts "Now run 'rake qwester:reset_positions RAILS_ENV=#{Rails.env}' to set the positions"
    puts "=============================================="
  end
  
  def down
    remove_column qq_table, :id
    remove_column qq_table, :position
    remove_column qq_table, :created_at
    remove_column qq_table, :updated_at
  end
  
  def qq_table
    :qwester_questionnaires_questions
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
qwester-0.5.0 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.4.0 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.3.5 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.3.4 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.3.3 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.3.2 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.3.1 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.3.0 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.2.2 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.2.1 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.2.0 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.1.4 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.1.3 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.1.2 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.1.1 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.1.0 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.0.9 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.0.8 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb
qwester-0.0.7 db/migrate/20121120092108_add_ids_to_questionnaires_questions.rb