Class: CreateTaboosAndTabooPosts

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/big_brotha/templates/migrations/create_taboos_and_taboo_posts.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/big_brotha/templates/migrations/create_taboos_and_taboo_posts.rb', line 2

def change
  create_table :taboos do |t|
    t.string :keyword, null: false, unique: true
    t.timestamps
  end

  create_table :taboo_posts do |t|
    t.text :content, null: false
    t.string :content_column
    t.belongs_to :user
    t.timestamps
  end

  create_join_table :taboo_posts, :taboos do |t|
    t.index [:taboo_post_id, :taboo_id]
    t.index [:taboo_id, :taboo_post_id]
  end

end