Class: CreateSlugs

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

Class Method Summary collapse

Class Method Details

.downObject



15
16
17
# File 'lib/generators/jabe/templates/migrations/create_slugs.rb', line 15

def self.down
  drop_table :slugs
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/generators/jabe/templates/migrations/create_slugs.rb', line 2

def self.up
  create_table :slugs do |t|
    t.string :name
    t.integer :sluggable_id
    t.integer :sequence, :null => false, :default => 1
    t.string :sluggable_type, :limit => 40
    t.string :scope
    t.datetime :created_at
  end
  add_index :slugs, :sluggable_id
  add_index :slugs, [:name, :sluggable_type, :sequence, :scope], :name => "index_slugs_on_n_s_s_and_s", :unique => true
end