Sha256: d070d53a6959ab296c60430af77ce9091f56d100572c7c5b70a7b917fd007cfc

Contents?: true

Size: 757 Bytes

Versions: 10

Compression:

Stored size: 757 Bytes

Contents

class AddPolls < ActiveRecord::Migration
  def self.up
    create_table :polls do |t|
      t.column :question,   :string
      t.column :created_at, :datetime
      t.column :updated_at, :datetime
      t.column :post_id, :integer
      t.column :votes_count, :integer, :default => 0
    end
    
    create_table :choices do |t|
      t.column :poll_id, :integer
      t.column :description, :string
      t.column :votes_count, :integer, :default => 0
    end
    
    create_table :votes do |t|
      t.column :user_id, :integer
      t.column :poll_id, :integer
      t.column :choice_id, :integer
      t.column :created_at, :datetime
    end
  end

  def self.down
    drop_table :polls
    drop_table :choices    
    drop_table :votes    
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
community_engine-3.2.0 db/migrate/047_add_polls.rb
community_engine-3.0.0 db/migrate/047_add_polls.rb
community_engine-2.3.2 db/migrate/047_add_polls.rb
community_engine-2.3.1 db/migrate/047_add_polls.rb
community_engine-2.3.0 db/migrate/047_add_polls.rb
community_engine-2.1.0 db/migrate/047_add_polls.rb
community_engine-2.0.0 db/migrate/047_add_polls.rb
community_engine-2.0.0.beta3 db/migrate/047_add_polls.rb
community_engine-2.0.0.beta2 db/migrate/047_add_polls.rb
community_engine-2.0.0.beta1 db/migrate/047_add_polls.rb