chore(postgres): improve article about rds, start recording scripts for databases

This commit is contained in:
Michele Cereda
2024-06-27 23:51:19 +02:00
parent e3a8f3d7f9
commit adfd4dc7fb
2 changed files with 105 additions and 23 deletions

33
snippets/postgresql.sql Normal file
View File

@@ -0,0 +1,33 @@
-- Close the connection to the current DB
\q
-- Show extensions.
SELECT "*" FROM "pg_extension";
SELECT "extname" FROM "pg_extension";
-- Add extensions
CREATE EXTENSION "pg_transport";
CREATE EXTENSION IF NOT EXISTS "pgaudit";
-- Remove extensions
DROP EXTENSION "plpgsql", "btree_gist", CASCADE;
-- Simulate DB transfers
-- Requires 'pg_transport' to be installed on both the source and destination DBs
-- Requires 'pg_transport' to be the *only* extension active on the source
SELECT transport.import_from_server(
'up.to.63.chars.source.fqdn', 5432,
'source.username', 'source.password', 'source.db',
'destination.password',
true
);
-- Run DB transfers
-- Requires 'pg_transport' to be installed on both the source and destination DBs
-- Requires 'pg_transport' to be the *only* extension active on the source
SELECT transport.import_from_server(
'up.to.63.chars.source.fqdn', 5432,
'source.username', 'source.password', 'source.db',
'destination.password',
false
);