hs.hsadmin.ng/sql/historization.sql

31 lines
1.5 KiB
MySQL
Raw Normal View History

2022-07-22 13:31:37 +02:00
-- ========================================================
2024-08-27 20:34:39 +02:00
-- Historization twiddle
2022-07-22 13:31:37 +02:00
-- --------------------------------------------------------
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
2024-08-27 16:31:37 +02:00
-- set hsadminng.tx_history_txid to (select max(txid) from tx_context where txtimestamp<='2024-08-27 12:13:13.450821');
2024-08-27 20:36:32 +02:00
set hsadminng.tx_history_txid to '2604';
2024-08-27 20:13:27 +02:00
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');
2024-08-27 20:36:32 +02:00
select uuid, version, type, identifier, caption from hs_hosting_asset_hv p where identifier in ('hsh00', 'mim00');
2024-08-27 16:31:37 +02:00
select pg_current_xact_id();