Skip to content

Commit 902334b

Browse files
authored
Update README.md
1 parent a5e4910 commit 902334b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,19 @@ UPDATE pg_database
129129
SET datistemplate = false
130130
WHERE datname = 'template_database_name';
131131

132+
```sql
133+
-- Deactivate connections
134+
SELECT pg_terminate_backend(pid)
135+
FROM pg_stat_activity
136+
WHERE datname = 'source_database_name' or datname = 'new_database_name'
137+
AND pid != pg_backend_pid();
138+
```
139+
132140
-- Drop the template database
133141
DROP DATABASE "template_database_name";
142+
143+
-- Drop the new database
144+
DROP DATABASE "new_database_name";
134145
```
135146

136147
## Troubleshooting
@@ -159,4 +170,4 @@ DROP DATABASE "template_database_name";
159170

160171
## License
161172

162-
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](https://opensource.org/license/mit) file for details.
173+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](https://opensource.org/license/mit) file for details.

0 commit comments

Comments
 (0)