602 B
602 B
Этап 1. Создание дампов
1.1. Дамп СХЕМЫ (только таблицы, без функций/триггеров)
pg_dump -p 5436 -U postgres -d edemo_ehd1 \
--schema-only \
--clean \
--if-exists \
--exclude-function \
--exclude-trigger \
--exclude-table="*" \
--exclude-schema=pg_catalog,information_schema \
2>/dev/null | \
grep -vE '^(CREATE|ALTER|DROP) (ROLE|TABLESPACE)' | \
sed -E 's/OWNER TO [^;]+;/OWNER TO current_user;/g' | \
sed -E 's/ TABLESPACE = [^;]+//g' \
> /opt/pg_dumps/01_schema_tables.sql
```