require 'prb/prb'
require 'prb/opt'

def main
  n, db, user, pw = DBIPool::check_options(ARGV)

  if /^DBI:Pg:(.+)$/ =~ db
    system("dropdb #{$1}")
    system("createdb #{$1}")
  end

  pool = DBIPool.new(n, db, user, pw)
  prb = PRb::Store.new(pool)

  prb.setup_table
end

main
