DO $$
declare
    _guid uuid := gen_random_uuid();
begin
    INSERT INTO vclib.t_object_modification_action (
        objectmodificationactionid,
        entities,
        position,
        type_,
        active,
        name,
        instruction,
        instructiontype
    )
    VALUES (
        _guid,
        (select entityid from vclib.t_entities where entname = 'PHARMACY' LIMIT 1),
        1,
        (select entityid from vclib.t_entities where entname = 'SINGLE_MODIFICATION_ACTION' LIMIT 1),
        false,
        'sp_RDS_Pharmacy',
        'sp_RDS_Pharmacy',
        0
    );

    INSERT INTO vclib.t_object_modification_action_param (
        objectmodificationactionparamid,
        objectmodificationaction,
        paramvalue,
        name
    )
    VALUES (
        gen_random_uuid(),
        _guid,
        '<lx:Path OwnerQueryLevel="0" xmlns:lx="lexem"><lx:StepString name="ObjectProperties" /><lx:StepString name="IsNew" /></lx:Path>',
        '@IsNew'
    );

    INSERT INTO vclib.t_object_modification_action_param (
        objectmodificationactionparamid,
        objectmodificationaction,
        paramvalue,
        name
    )
    VALUES (
        gen_random_uuid(),
        _guid,
        '<lx:Path OwnerQueryLevel="0" xmlns:lx="lexem"><lx:StepString name="Code" /></lx:Path>',
        '@ID'
    );
end $$;