Sha256: 1acda2dc05bc4188106c78bcf96b8ad61df33514f36aad3aef0157b2e4a67520

Contents?: true

Size: 602 Bytes

Versions: 13

Compression:

Stored size: 602 Bytes

Contents

class CreateBlogoTaggings < ActiveRecord::Migration
  def change
    taggings_table = "#{Blogo.table_name_prefix}taggings"

    create_table(taggings_table) do |t|
      t.integer :post_id, null: false
      t.integer :tag_id , null: false
    end

    add_index taggings_table, [:tag_id, :post_id], unique: true

    if defined?(Foreigner)
      tags_table  = "#{Blogo.table_name_prefix}tags"
      posts_table = "#{Blogo.table_name_prefix}posts"

      add_foreign_key taggings_table, tags_table , column: :tag_id
      add_foreign_key taggings_table, posts_table, column: :post_id
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
blogo-0.1.4 db/migrate/20140218134620_create_blogo_taggings.rb
blogo-0.1.3 db/migrate/20140218134620_create_blogo_taggings.rb
blogo-0.1.2 db/migrate/20140218134620_create_blogo_taggings.rb
blogo-0.1.1 db/migrate/20140218134620_create_blogo_taggings.rb
blogo-0.1.0 db/migrate/20140218134620_create_blogo_taggings.rb
blogo-0.0.10 db/migrate/20140218134620_create_blogo_taggings.rb
blogo-0.0.9 db/migrate/20140218134620_create_blogo_taggings.rb
blogo-0.0.8 db/migrate/20140218134620_create_blogo_taggings.rb
blogo-0.0.7 db/migrate/20140218134620_create_blogo_taggings.rb
blogo-0.0.6 db/migrate/20140218134620_create_blogo_taggings.rb
blogo-0.0.5 db/migrate/20140218134620_create_blogo_taggings.rb
blogo-0.0.4 db/migrate/20140218134620_create_blogo_taggings.rb
blogo-0.0.3 db/migrate/20140218134620_create_blogo_taggings.rb