Class: ActsAsTaggableSimpleMigration

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/acts_as_taggable_simple/migration/templates/active_record/migration.rb

Overview

Migration file for migrating over all necessay tables to use acts_as_taggable_simple.

Tables

Tags

  • name - the String representation of the tag

Taggings

  • taggable - the record being tagged

  • tag - the tag that is associated with the record

Class Method Summary collapse

Class Method Details

.downObject

:nodoc:



28
29
30
31
32
# File 'lib/generators/acts_as_taggable_simple/migration/templates/active_record/migration.rb', line 28

def self.down #:nodoc:
  drop_table :tagging

  drop_table :tags
end

.upObject

:nodoc:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/generators/acts_as_taggable_simple/migration/templates/active_record/migration.rb', line 13

def self.up #:nodoc:
  create_table :tags do |t|
    t.string :name
  end

  add_index :tags, :name, :unique => true

  create_table :taggings do |t|
    t.references :taggable, :polymorphic => true
    t.references :tag

    t.string :context
  end
end