Sha256: d47f6f0a7bb74f26bfb2d8d26dcc35089a27bae540384999d1957b5d097fb1af
Contents?: true
Size: 702 Bytes
Versions: 1
Compression:
Stored size: 702 Bytes
Contents
class CreateUuidifyUuids < ActiveRecord::Migration def up uuid_type = connection.adapter_name == "PostgreSQL" ? :string : :binary create_table :uuidify_uuids do |t| t.string :model_name t.integer :model_id if uuid_type == :string t.string :model_uuid, :limit => 36 end end if uuid_type == :binary execute "ALTER TABLE uuidify_uuids ADD COLUMN model_uuid BINARY(16)" end add_index :uuidify_uuids, [:model_name, :model_id], :unique => true add_index :uuidify_uuids, :model_uuid, :unique => true add_index :uuidify_uuids, [:model_uuid, :model_id], :unique => true end def down drop_table :uuidify_uuids end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
uuidify-0.5.0 | db/migrate/20130612143347_create_uuidify_uuids.rb |