group BusinessSubscriptionTransitionTag;

CHECK_TENANT() ::= "tenant_record_id = :tenantRecordId"
AND_CHECK_TENANT() ::= "AND <CHECK_TENANT()>"

getTagsForBusinessSubscriptionTransitionByKey(external_key) ::=<<
select
  bundle_id
, external_key
, account_key
, name
, tenant_record_id
from bst_tags
where external_key = :external_key
<AND_CHECK_TENANT()>
;
>>

addTag(bundle_id, external_key, name) ::=<<
insert into bst_tags (
  bundle_id
, external_key
, account_key
, name
, account_record_id
, tenant_record_id
) values (
  :bundle_id
, :external_key
, :account_key
, :name
, :accountRecordId
, :tenantRecordId
);
>>

removeTag(bundle_id, name) ::= <<
delete from bst_tags where bundle_id = :bundle_id and name = :name <AND_CHECK_TENANT()>;
>>

test() ::= <<
select 1 from bst_tags where <CHECK_TENANT()>;
>>
