# encoding: utf-8

module CartoDB
  module Relocator
    class Environment
      def initialize(environment='development', user_id)
        @environment  = environment
        @user_id      = user_id
      end #initialize

      def database_username
        return "cartodb_staging_user_#{user_id}" if environment == 'staging'
        "#{environment}_cartodb_user_#{user_id}"
      end #database_username

      def user_database
        return "cartodb_dev_user_#{user_id}_db" if environment == 'development'
        "cartodb_#{environment}_user_#{user_id}_db"
      end #user_database

      private

      attr_accessor :environment, :user_id
    end # Environment
  end # Relocator
end # CartoDB


# encoding: utf-8

module CartoDB
  module Relocator
    class Environment
      def initialize(environment='development', user_id)
        @environment  = environment
        @user_id      = user_id
      end #initialize

      def database_username
        return "cartodb_user_#{user_id}" if environment == 'production'
        return "cartodb_staging_user_#{user_id}" if environment == 'staging'
        "#{environment}_cartodb_user_#{user_id}"
      end #database_username

      def user_database
        return "cartodb_user_#{user_id}_db" if environment == 'production'
        return "cartodb_dev_user_#{user_id}_db" if environment == 'development'
        "cartodb_#{environment}_user_#{user_id}_db"
      end #user_database

      private

      attr_accessor :environment, :user_id
    end # Environment
  end # Relocator
end # CartoDB

Fix pg db/user names in relocator prod env
Fix pg db/user names in relocator prod env
