Sha256: f3f0757ff5f35a6570b6a6101c732250d6d108ad8bd43661cd017d8805fdf474

Contents?: true

Size: 641 Bytes

Versions: 16

Compression:

Stored size: 641 Bytes

Contents

class RemoveUuid < ActiveRecord::Migration
  @@uuid_configured = false

  def self.up
    [ :users, :accounts, :campaigns, :leads, :contacts, :opportunities, :tasks ].each do |table|
      remove_column table, :uuid
      if self.uuid_configured?
        execute("DROP TRIGGER IF EXISTS #{table}_uuid")
      end
    end
  end

  def self.down
    raise ActiveRecord::IrreversibleMigration, "Can't recover deleted UUIDs"
  end

  private
  def self.uuid_configured?
    return @@uuid_configured if @@uuid_configured
    config = ActiveRecord::Base.connection.instance_variable_get("@config")
    @@uuid_configured = config[:uuid]
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.13.5 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.13.4 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.13.3 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.13.2 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.12.3 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.12.2 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.13.1 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.12.1 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.13.0 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.12.0 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.11.4 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.11.3 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.11.2 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.11.1 db/migrate/20100928030620_remove_uuid.rb
fat_free_crm-0.11.0 db/migrate/20100928030620_remove_uuid.rb