Skip to content

Instantly share code, notes, and snippets.

@snoblenet
Created February 15, 2010 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snoblenet/304534 to your computer and use it in GitHub Desktop.
Save snoblenet/304534 to your computer and use it in GitHub Desktop.
class CreateSlugs < ActiveRecord::Migration
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, :limit => 40
t.datetime :created_at
end
add_index :slugs, [:name, :sluggable_type, :scope, :sequence], :unique => true
add_index :slugs, :sluggable_id
end
def self.down
drop_table :slugs
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment