• Stan Hu's avatar
    Kill all PostgreSQL connections for rake dev:setup · 5488e8a4
    Stan Hu authored
    If there are any clients connected to the DB, PostgreSQL won't let you
    drop the database. It's possible that Sidekiq, Unicorn, or some other
    client will be hanging onto a connection, preventing the DROP DATABASE
    from working. To workaround this problem, this method cancels all the
    connections so that the db:reset command will work.
    
    Note that there's still a slight possibility a client connects after its
    connection is terminated. If this is an issue, we could solve it by
    revoking CONNECT access, but for now it seems this works.
    
    Closes https://gitlab.com/gitlab-org/gitlab-development-kit/issues/450
    5488e8a4
setup.rake 1.18 KB