mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 21:09:11 +00:00
20 lines
586 B
SQL
20 lines
586 B
SQL
-- Connect to a different database first (postgres) since we can't drop a database while connected to it
|
|
\c postgres;
|
|
|
|
-- Terminate all connections to the databases
|
|
SELECT pg_terminate_backend(pid)
|
|
FROM pg_stat_activity
|
|
WHERE datname IN ('chainindex', 'highway', 'matrixhs')
|
|
AND pid <> pg_backend_pid();
|
|
|
|
-- Drop the databases if they exist
|
|
DROP DATABASE IF EXISTS chainindex;
|
|
DROP DATABASE IF EXISTS highway;
|
|
DROP DATABASE IF EXISTS matrixhs;
|
|
|
|
-- Drop the users if they exist
|
|
DROP USER IF EXISTS chainindex_user;
|
|
DROP USER IF EXISTS highway_user;
|
|
DROP USER IF EXISTS matrixhs_user;
|
|
|