class Switches::Backends::Postgres::Setup

Public Class Methods

new(connection) click to toggle source
# File lib/switches/backends/postgres/tasks/setup.rb, line 5
def initialize(connection)
  @connection = connection
end

Public Instance Methods

run() click to toggle source
# File lib/switches/backends/postgres/tasks/setup.rb, line 9
def run
  create_table
  create_index
end

Private Instance Methods

create_index() click to toggle source
# File lib/switches/backends/postgres/tasks/setup.rb, line 20
def create_index
  @connection.execute("CREATE UNIQUE INDEX switches_key ON switches (key)")
end
create_table() click to toggle source
# File lib/switches/backends/postgres/tasks/setup.rb, line 16
def create_table
  @connection.execute("CREATE TABLE switches (key varchar, value text)")
end