<?xml version="1.0" encoding="UTF-8"?>
<database name="centreon" package="centreon_configuration" defaultIdMethod="native">
  <table name="cfg_tags_bas" phpName="Tag" idMethod="native">
    <column name="tag_id" phpName="TagId" type="INTEGER" primaryKey="true" required="true"/>
    <column name="resource_id" phpName="ResourceId" type="INTEGER" primaryKey="true" required="true"/>
    <foreign-key foreignTable="cfg_tags" name="cfg_tags_bas_fk_01">
      <reference local="tag_id" foreign="tag_id"/>
    </foreign-key>
    <foreign-key foreignTable="cfg_bam" name="cfg_tags_bas_fk_02">
      <reference local="resource_id" foreign="ba_id"/>
    </foreign-key>
    <vendor type="mysql">
      <parameter name="Engine" value="InnoDB"/>
    </vendor>
  </table>
</database>

<?xml version="1.0" encoding="UTF-8"?>
<database name="centreon" package="centreon_configuration" defaultIdMethod="native">
  <table name="cfg_tags_bas" phpName="Tag" idMethod="native">
    <column name="tag_id" phpName="TagId" type="INTEGER" primaryKey="true" required="true"/>
    <column name="resource_id" phpName="ResourceId" type="INTEGER" primaryKey="true" required="true"/>
    <foreign-key foreignTable="cfg_tags" name="cfg_tags_bas_fk_01">
      <reference local="tag_id" foreign="tag_id"/>
    </foreign-key>
    <foreign-key foreignTable="cfg_bam" name="cfg_tags_bas_fk_02" onDelete="CASCADE" onUpdate="RESTRICT">
      <reference local="resource_id" foreign="ba_id"/>
    </foreign-key>
    <vendor type="mysql">
      <parameter name="Engine" value="InnoDB"/>
    </vendor>
  </table>
</database>

Fix BAM deletion when BA has tags
Fix BAM deletion when BA has tags
