hs.hsadmin.ng/sql/historization.sql
Michael Hoennig ea05773e26 cleanup
2024-08-29 09:51:54 +02:00

31 lines
1.5 KiB
SQL

-- ========================================================
-- Historization twiddle
-- --------------------------------------------------------
rollback;
begin transaction;
call defineContext('historization testing', null, 'superuser-alex@hostsharing.net',
'hs_booking_project#D-1000000-hshdefaultproject:ADMIN'); -- prod+test
-- 'hs_booking_project#D-1000300-mihdefaultproject:ADMIN'); -- prod
-- 'hs_booking_project#D-1000300-mimdefaultproject:ADMIN'); -- test
-- update hs_hosting_asset set caption='lug00 b' where identifier = 'lug00' and type = 'MANAGED_WEBSPACE'; -- prod
update hs_hosting_asset set caption='hsh00 C ' || now()::text where identifier = 'hsh00' and type = 'MANAGED_WEBSPACE'; -- test
update hs_hosting_asset set caption='hsh00 D ' || now()::text where identifier = 'hsh00' and type = 'MANAGED_WEBSPACE'; -- test
commit;
-- single version at point in time
-- set hsadminng.tx_history_txid to (select max(txid) from tx_context where txtimestamp<='2024-08-27 12:13:13.450821');
set hsadminng.tx_history_txid to '2604';
set hsadminng.tx_history_timestamp to '';
-- all versions
select tx_history_txid(), txc.txtimestamp, txc.currentUser, txc.currentTask, haex.*
from hs_hosting_asset_ex haex
join tx_context txc on haex.txid=txc.txid
where haex.identifier in ('hsh00', 'mim00');
select uuid, version, type, identifier, caption from hs_hosting_asset_hv p where identifier in ('hsh00', 'mim00');
select pg_current_xact_id();