Method: Azuki::Command::Pg#unfollow

Defined in:
lib/azuki/command/pg.rb

#unfollowObject

pg:unfollow REPLICA

stop a replica from following and make it a read/write database



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/azuki/command/pg.rb', line 112

def unfollow
  unless db = shift_argument
    error("Usage: azuki pg:unfollow REPLICA\nMust specify REPLICA to unfollow.")
  end
  validate_arguments!

  replica = hpg_resolve(db)
  replica_info = hpg_info(replica)

  unless replica_info[:following]
    error("#{replica.display_name} is not following another database.")
  end
  origin_url = replica_info[:following]
  origin_name = database_name_from_url(origin_url)

  output_with_bang "#{replica.display_name} will become writable and no longer"
  output_with_bang "follow #{origin_name}. This cannot be undone."
  return unless confirm_command

  action "Unfollowing #{replica.display_name}" do
    hpg_client(replica).unfollow
  end
end