Class: CreateTags

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/ecrire/db/migrate/20150318549479_create_tags.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/ecrire/db/migrate/20150318549479_create_tags.rb', line 2

def change
  create_table :tags do |t|

    t.string :name, null: false
    t.timestamps null: false
  end

  add_index :tags, :name, unique: true

  add_column :posts, :tags, :integer, array: true, defaut: []
end