tasks/entities.rake in flapjack-1.2.0rc1 vs tasks/entities.rake in flapjack-1.2.0rc2

- old
+ new

@@ -9,11 +9,14 @@ FLAPJACK_ENV = ENV['FLAPJACK_ENV'] || 'production' namespace :entities do def redis - @redis ||= Redis.new(@redis_config) + return @redis unless @redis.nil? + @redis = Redis.new(@redis_config.merge(:driver => :hiredis)) + Flapjack::Data::Migration.migrate_entity_check_data_if_required(:redis => @redis) + @redis end def orphaned_entity_names current_names = Flapjack::Data::Entity.all(:redis => redis).map(&:name) @@ -125,11 +128,11 @@ entity = id.nil? ? nil : Flapjack::Data::Entity.find_by_id(id) if id.nil? || entity.nil? id ||= SecureRandom.uuid redis.multi - redis.set("entity_id:#{name}", id) - redis.hset("entity:#{id}", 'name', name) + redis.hset('all_entity_ids_by_name', name, id) + redis.hset('all_entity_names_by_id', id, name) redis.exec puts "Set id '#{id}' for entity #{name}'" elsif entity.name.eql?(name) puts "'#{name}' entity already exists with the provided id" else \ No newline at end of file