Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CreateCategories < ActiveRecord::Migration
- def up
- create_table :categories do |t|
- t.integer :parent_id
- t.string :title, :null => false
- end
- execute('CREATE UNIQUE INDEX ix_categories_root_title ON categories (title) WHERE parent_id IS NULL')
- end
- def down
- drop_table :categories
- end
- end
- ActiveRecord::Schema.define(:version => 20110808161830) do
- create_table "categories", :force => true do |t|
- t.integer "parent_id"
- t.string "title", :null => false
- end
- add_index "categories", ["title"], :name => "ix_categories_root_title", :unique => true
- end
- config.active_record.schema_format = :sql
Add Comment
Please, Sign In to add comment