Class: FriendlyId::SequelAdapter::CreateSlugs

Inherits:
Sequel::Migration
  • Object
show all
Defined in:
lib/friendly_id/sequel_adapter/create_slugs.rb

Instance Method Summary collapse

Instance Method Details

#downObject



21
22
23
# File 'lib/friendly_id/sequel_adapter/create_slugs.rb', line 21

def down
  drop_table :slugs
end

#upObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/friendly_id/sequel_adapter/create_slugs.rb', line 7

def up
  create_table :slugs do
    primary_key :id, :type => Integer
    string :name
    integer :sluggable_id
    integer :sequence, :null => false, :default => 1
    string :sluggable_type, :limit => 40
    string :scope
    timestamp :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