Обсуждение: [NOVICE] Undo all changes made by production release

Поиск
Список
Период
Сортировка

[NOVICE] Undo all changes made by production release

От
Andrew Zakharov
Дата:
Hello colleagues -

I got a task - to write database rollback script for some reason (revert project release changes to previous release version). The rollback decision will be made by the customer during next working day in any moment if any problems appear. The data coming from users thru that next day must stay in the system but all objects like code and tables' structures etc must be reverted.
My rollback idea is:
1. Writing the script that revert tables', indices etc structures back
2. Drop all triggers, views and functions
3. Apply all triggers, views and functions from scripts of the previous release

#3 guarantees that there will be previous code version and content.

I assume that this plan works but there is one big problem. Some function-based indices/constraints will be dropped when processing "cascade" option for step #2.
Now I'm trying to search these indices and constrains but I dont see any "function-based" signs in pg views. Looking the FAQs, DOCs up got no clues.

Do you have an idea how to dynamically -
a) detect objects (indices and constraints etc) which containing references to functions
b) get the DDL for them

The final idea is to store such DDLs somewhere before installing new version of prod release and use it for rolling back.

Thanx.

--
Andrew Zakharov