Sha256: 051db9a5863fd824385bf767e7386d8ac04a92db935588e6ea34129fbb8c75f4
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
class AddBrainstormingProduct < ActiveRecord::Migration def up if Product::Brainstorming.first else Product::Brainstorming.create(name: 'Brainstorming', text: 'Dummy') end create_table :brainstormings, force: true do |t| t.integer :user_id t.string :name t.string :slug t.text :text t.timestamps end add_index :brainstormings, :user_id add_index :brainstormings, [:slug, :user_id], unique: true create_table :brainstorming_ideas, force: true do |t| t.integer :brainstorming_id t.integer :user_id t.string :name t.text :text t.integer :votes_count, default: 0 t.timestamps end add_index :brainstorming_ideas, :user_id add_index :brainstorming_ideas, [:brainstorming_id, :name], unique: true create_table :brainstorming_idea_votes, force: true do |t| t.integer :idea_id t.integer :user_id t.timestamps end add_index :brainstorming_idea_votes, :idea_id add_index :brainstorming_idea_votes, :user_id add_index :brainstorming_idea_votes, [:idea_id, :user_id], unique: true end def down if product = Product::Brainstorming.first product.destroy end drop_table :brainstormings drop_table :brainstorming_ideas drop_table :brainstorming_idea_votes end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
voluntary_brainstorming-0.0.2 | db/migrate/20150818181847_add_brainstorming_product.rb |