group TenantKVSqlDao: EntitySqlDao;

tableName() ::= "tenant_kvs"

tableFields(prefix) ::= <<
  <prefix>t_key
, <prefix>t_value
, <prefix>is_active
, <prefix>created_date
, <prefix>created_by
, <prefix>updated_date
, <prefix>updated_by
>>

tableValues() ::= <<
  :key
, :value
, :isActive
, :createdDate
, :createdBy
, :updatedDate
, :updatedBy
>>

accountRecordIdFieldWithComma() ::= ""

accountRecordIdValueWithComma() ::= ""


getTenantValueForKey() ::= <<
select
  <allTableFields("t.")>
from <tableName()> t
where t.t_key = :key
<AND_CHECK_TENANT("t.")>
;
>>

markTenantKeyAsDeleted() ::= <<
update <tableName()> t
set t.is_active = 0
where t.t_key = :key
<AND_CHECK_TENANT("t.")>
;
>>
