<?xml version="1.0"?>
<!--
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package TikTok Pixel by Amasty
 */-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
    <table name="amasty_pixel_tiktok_api" resource="default" engine="innodb"
           comment="Amasty TikTok Pixel API Data">
        <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="ID"/>
        <column xsi:type="int" name="pixel_id" unsigned="true" nullable="false" comment="Pixel ID"/>
        <column xsi:type="varchar" name="access_token" nullable="true" length="255" comment="Access Token"/>
        <column xsi:type="varchar" name="test_event_code" nullable="true" length="255" comment="Test Event Code"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="id"/>
        </constraint>
        <index referenceId="AMASTY_PIXEL_TIKTOK_PIXEL_ID" indexType="btree">
            <column name="pixel_id"/>
        </index>
        <constraint xsi:type="foreign" referenceId="AMASTY_PIXEL_TIKTOK_API_AMASTY_PIXEL"
                    table="amasty_pixel_tiktok_api"
                    column="pixel_id"
                    referenceTable="amasty_pixel"
                    referenceColumn="entity_id"
                    onDelete="CASCADE"/>
    </table>
</schema>
