To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / vendor / plugins / redmine_tags / db / migrate / 001_acts_as_taggable_on_migration.rb @ 757:d38f5a55c590
History | View | Annotate | Download (751 Bytes)
| 1 | 593:f12948591050 | chris | class ActsAsTaggableOnMigration < ActiveRecord::Migration |
|---|---|---|---|
| 2 | def self.up |
||
| 3 | create_table :tags do |t| |
||
| 4 | t.column :name, :string |
||
| 5 | end
|
||
| 6 | |||
| 7 | create_table :taggings do |t| |
||
| 8 | t.column :tag_id, :integer |
||
| 9 | t.column :taggable_id, :integer |
||
| 10 | t.column :tagger_id, :integer |
||
| 11 | t.column :tagger_type, :string |
||
| 12 | |||
| 13 | # You should make sure that the column created is
|
||
| 14 | # long enough to store the required class names.
|
||
| 15 | t.column :taggable_type, :string |
||
| 16 | t.column :context, :string |
||
| 17 | |||
| 18 | t.column :created_at, :datetime |
||
| 19 | end
|
||
| 20 | |||
| 21 | add_index :taggings, :tag_id |
||
| 22 | add_index :taggings, [:taggable_id, :taggable_type, :context] |
||
| 23 | end
|
||
| 24 | |||
| 25 | def self.down |
||
| 26 | drop_table :taggings
|
||
| 27 | drop_table :tags
|
||
| 28 | end
|
||
| 29 | end |