<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
  <table name="mageworx_seoredirects_redirect_dp" resource="default" engine="innodb" comment="mageworx_seoredirects_redirect_dp">
    <column xsi:type="int" name="redirect_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Redirect ID"/>
    <column xsi:type="int" name="product_id" padding="10" unsigned="true" nullable="true" identity="false" comment="Product ID"/>
    <column xsi:type="text" name="product_name" nullable="true" comment="Deleted Product Name"/>
    <column xsi:type="text" name="product_sku" nullable="true" comment="Deleted Product SKU"/>
    <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store Id"/>
    <column xsi:type="text" name="request_path" nullable="true" comment="Request Path"/>
    <column xsi:type="int" name="category_id" padding="10" unsigned="true" nullable="true" identity="false" comment="Request Category ID"/>
    <column xsi:type="smallint" name="priority_category_id" padding="5" unsigned="true" nullable="true" identity="false" comment="Targeted Category ID"/>
    <column xsi:type="datetime" name="date_created" on_update="false" nullable="false" default="0" comment="Date Created"/>
    <column xsi:type="smallint" name="hits" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Hits"/>
    <column xsi:type="smallint" name="status" padding="5" unsigned="true" nullable="false" identity="false" default="1" comment="Is Active"/>
    <constraint xsi:type="primary" referenceId="PRIMARY">
      <column name="redirect_id"/>
    </constraint>
  </table>
  <table name="mageworx_seoredirects_redirect_custom" resource="default" engine="innodb" comment="mageworx_seoredirects_redirect_custom">
    <column xsi:type="int" name="redirect_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Redirect ID"/>
    <column xsi:type="smallint" name="redirect_code" padding="5" unsigned="true" nullable="true" identity="false" comment="Redirect Code"/>
    <column xsi:type="smallint" name="request_entity_type" padding="5" unsigned="true" nullable="true" identity="false" comment="Request From(Type)"/>
    <column xsi:type="varchar" name="request_entity_identifier" nullable="true" length="255" comment="Request Entity Identifier"/>
    <column xsi:type="smallint" name="target_entity_type" padding="5" unsigned="true" nullable="true" identity="false" comment="Request To(Type)"/>
    <column xsi:type="varchar" name="target_entity_identifier" nullable="true" length="255" comment="Target Entity Identifier"/>
    <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store Id"/>
    <column xsi:type="timestamp" name="date_created" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" comment="Creation Time"/>
    <column xsi:type="timestamp" name="date_modified" on_update="true" nullable="false" default="CURRENT_TIMESTAMP" comment="Update Time"/>
    <column xsi:type="boolean" name="is_autogenerated" nullable="false" comment="Is Autogenerated"/>
    <column xsi:type="smallint" name="status" padding="5" unsigned="true" nullable="false" identity="false" default="1" comment="Is Active"/>
    <column xsi:type="boolean" name="is_imported" nullable="false" comment="Is Imported"/>
    <column xsi:type="timestamp" name="start_at" on_update="false" nullable="true" comment="Active From"/>
    <column xsi:type="timestamp" name="finish_at" on_update="false" nullable="true" comment="Active To"/>
    <constraint xsi:type="primary" referenceId="PRIMARY">
      <column name="redirect_id"/>
    </constraint>
    <constraint xsi:type="foreign" referenceId="MAGEWORX_SEOREDIRECTS_REDIRECT_CUSTOM_STORE_ID_STORE_STORE_ID" table="mageworx_seoredirects_redirect_custom" column="store_id" referenceTable="store" referenceColumn="store_id" onDelete="CASCADE"/>
    <constraint xsi:type="unique" referenceId="UNQ_78BAEA4E69DD91FBECDB7A3F83D52BBE">
      <column name="request_entity_type"/>
      <column name="request_entity_identifier"/>
      <column name="store_id"/>
      <column name="status"/>
    </constraint>
  </table>
</schema>
