File: /var/www/vhost/disk-apps/magento.bikenow.co/vendor/magento/module-reports/etc/db_schema.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="report_compared_product_index" resource="default" engine="innodb"
comment="Reports Compared Product Index Table">
<column xsi:type="bigint" name="index_id" unsigned="true" nullable="false" identity="true"
comment="Index ID"/>
<column xsi:type="int" name="visitor_id" unsigned="true" nullable="true" identity="false"
comment="Visitor ID"/>
<column xsi:type="int" name="customer_id" unsigned="true" nullable="true" identity="false"
comment="Customer ID"/>
<column xsi:type="int" name="product_id" unsigned="true" nullable="false" identity="false"
comment="Product ID"/>
<column xsi:type="smallint" name="store_id" unsigned="true" nullable="true" identity="false"
comment="Store ID"/>
<column xsi:type="timestamp" name="added_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP"
comment="Added At"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="index_id"/>
</constraint>
<constraint xsi:type="foreign" referenceId="REPORT_CMPD_PRD_IDX_CSTR_ID_CSTR_ENTT_ENTT_ID"
table="report_compared_product_index" column="customer_id" referenceTable="customer_entity"
referenceColumn="entity_id" onDelete="CASCADE"/>
<constraint xsi:type="foreign" referenceId="REPORT_CMPD_PRD_IDX_PRD_ID_CAT_PRD_ENTT_ENTT_ID"
table="report_compared_product_index" column="product_id" referenceTable="catalog_product_entity"
referenceColumn="entity_id" onDelete="CASCADE"/>
<constraint xsi:type="foreign" referenceId="REPORT_COMPARED_PRODUCT_INDEX_STORE_ID_STORE_STORE_ID"
table="report_compared_product_index" column="store_id" referenceTable="store"
referenceColumn="store_id" onDelete="SET NULL"/>
<constraint xsi:type="unique" referenceId="REPORT_COMPARED_PRODUCT_INDEX_VISITOR_ID_PRODUCT_ID">
<column name="visitor_id"/>
<column name="product_id"/>
</constraint>
<constraint xsi:type="unique" referenceId="REPORT_COMPARED_PRODUCT_INDEX_CUSTOMER_ID_PRODUCT_ID">
<column name="customer_id"/>
<column name="product_id"/>
</constraint>
<index referenceId="REPORT_COMPARED_PRODUCT_INDEX_STORE_ID" indexType="btree">
<column name="store_id"/>
</index>
<index referenceId="REPORT_COMPARED_PRODUCT_INDEX_ADDED_AT" indexType="btree">
<column name="added_at"/>
</index>
<index referenceId="REPORT_COMPARED_PRODUCT_INDEX_PRODUCT_ID" indexType="btree">
<column name="product_id"/>
</index>
</table>
<table name="report_viewed_product_index" resource="default" engine="innodb"
comment="Reports Viewed Product Index Table">
<column xsi:type="bigint" name="index_id" unsigned="true" nullable="false" identity="true"
comment="Index ID"/>
<column xsi:type="int" name="visitor_id" unsigned="true" nullable="true" identity="false"
comment="Visitor ID"/>
<column xsi:type="int" name="customer_id" unsigned="true" nullable="true" identity="false"
comment="Customer ID"/>
<column xsi:type="int" name="product_id" unsigned="true" nullable="false" identity="false"
comment="Product ID"/>
<column xsi:type="smallint" name="store_id" unsigned="true" nullable="true" identity="false"
comment="Store ID"/>
<column xsi:type="timestamp" name="added_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP"
comment="Added At"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="index_id"/>
</constraint>
<constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRD_IDX_CSTR_ID_CSTR_ENTT_ENTT_ID"
table="report_viewed_product_index" column="customer_id" referenceTable="customer_entity"
referenceColumn="entity_id" onDelete="CASCADE"/>
<constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRD_IDX_PRD_ID_CAT_PRD_ENTT_ENTT_ID"
table="report_viewed_product_index" column="product_id" referenceTable="catalog_product_entity"
referenceColumn="entity_id" onDelete="CASCADE"/>
<constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRODUCT_INDEX_STORE_ID_STORE_STORE_ID"
table="report_viewed_product_index" column="store_id" referenceTable="store"
referenceColumn="store_id" onDelete="SET NULL"/>
<constraint xsi:type="unique" referenceId="REPORT_VIEWED_PRODUCT_INDEX_VISITOR_ID_PRODUCT_ID">
<column name="visitor_id"/>
<column name="product_id"/>
</constraint>
<constraint xsi:type="unique" referenceId="REPORT_VIEWED_PRODUCT_INDEX_CUSTOMER_ID_PRODUCT_ID">
<column name="customer_id"/>
<column name="product_id"/>
</constraint>
<index referenceId="REPORT_VIEWED_PRODUCT_INDEX_STORE_ID" indexType="btree">
<column name="store_id"/>
</index>
<index referenceId="REPORT_VIEWED_PRODUCT_INDEX_ADDED_AT" indexType="btree">
<column name="added_at"/>
</index>
<index referenceId="REPORT_VIEWED_PRODUCT_INDEX_PRODUCT_ID" indexType="btree">
<column name="product_id"/>
</index>
</table>
<table name="report_event_types" resource="default" engine="innodb" comment="Reports Event Type Table">
<column xsi:type="smallint" name="event_type_id" unsigned="true" nullable="false" identity="true"
comment="Event Type ID"/>
<column xsi:type="varchar" name="event_name" nullable="false" length="64" comment="Event Name"/>
<column xsi:type="smallint" name="customer_login" unsigned="true" nullable="false" identity="false"
default="0" comment="Customer Login"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="event_type_id"/>
</constraint>
</table>
<table name="report_event" resource="default" engine="innodb" comment="Reports Event Table">
<column xsi:type="bigint" name="event_id" unsigned="true" nullable="false" identity="true"
comment="Event ID"/>
<column xsi:type="timestamp" name="logged_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP"
comment="Logged At"/>
<column xsi:type="smallint" name="event_type_id" unsigned="true" nullable="false" identity="false"
default="0" comment="Event Type ID"/>
<column xsi:type="int" name="object_id" unsigned="true" nullable="false" identity="false"
default="0" comment="Object ID"/>
<column xsi:type="int" name="subject_id" unsigned="true" nullable="false" identity="false"
default="0" comment="Subject ID"/>
<column xsi:type="smallint" name="subtype" unsigned="true" nullable="false" identity="false"
default="0" comment="Subtype"/>
<column xsi:type="smallint" name="store_id" unsigned="true" nullable="false" identity="false"
comment="Store ID"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="event_id"/>
</constraint>
<constraint xsi:type="foreign" referenceId="REPORT_EVENT_STORE_ID_STORE_STORE_ID" table="report_event"
column="store_id" referenceTable="store" referenceColumn="store_id" onDelete="CASCADE"/>
<constraint xsi:type="foreign" referenceId="REPORT_EVENT_EVENT_TYPE_ID_REPORT_EVENT_TYPES_EVENT_TYPE_ID"
table="report_event" column="event_type_id" referenceTable="report_event_types"
referenceColumn="event_type_id" onDelete="CASCADE"/>
<index referenceId="REPORT_EVENT_EVENT_TYPE_ID" indexType="btree">
<column name="event_type_id"/>
</index>
<index referenceId="REPORT_EVENT_SUBJECT_ID" indexType="btree">
<column name="subject_id"/>
</index>
<index referenceId="REPORT_EVENT_OBJECT_ID" indexType="btree">
<column name="object_id"/>
</index>
<index referenceId="REPORT_EVENT_SUBTYPE" indexType="btree">
<column name="subtype"/>
</index>
<index referenceId="REPORT_EVENT_STORE_ID" indexType="btree">
<column name="store_id"/>
</index>
</table>
<table name="report_viewed_product_aggregated_daily" resource="default" engine="innodb"
comment="Most Viewed Products Aggregated Daily">
<column xsi:type="int" name="id" unsigned="true" nullable="false" identity="true" comment="ID"/>
<column xsi:type="date" name="period" comment="Period"/>
<column xsi:type="smallint" name="store_id" unsigned="true" nullable="true" identity="false"
comment="Store ID"/>
<column xsi:type="int" name="product_id" unsigned="true" nullable="true" identity="false"
comment="Product ID"/>
<column xsi:type="varchar" name="product_name" nullable="true" length="255" comment="Product Name"/>
<column xsi:type="decimal" name="product_price" scale="4" precision="12" unsigned="false" nullable="false"
default="0" comment="Product Price"/>
<column xsi:type="int" name="views_num" unsigned="false" nullable="false" identity="false"
default="0" comment="Number of Views"/>
<column xsi:type="smallint" name="rating_pos" unsigned="true" nullable="false" identity="false"
default="0" comment="Rating Pos"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="id"/>
</constraint>
<constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_DAILY_STORE_ID_STORE_STORE_ID"
table="report_viewed_product_aggregated_daily" column="store_id" referenceTable="store"
referenceColumn="store_id" onDelete="CASCADE"/>
<constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRD_AGGRED_DAILY_PRD_ID_CAT_PRD_ENTT_ENTT_ID"
table="report_viewed_product_aggregated_daily" column="product_id"
referenceTable="catalog_product_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
<constraint xsi:type="unique" referenceId="REPORT_VIEWED_PRD_AGGRED_DAILY_PERIOD_STORE_ID_PRD_ID">
<column name="period"/>
<column name="store_id"/>
<column name="product_id"/>
</constraint>
<index referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_DAILY_STORE_ID" indexType="btree">
<column name="store_id"/>
</index>
<index referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_DAILY_PRODUCT_ID" indexType="btree">
<column name="product_id"/>
</index>
</table>
<table name="report_viewed_product_aggregated_monthly" resource="default" engine="innodb"
comment="Most Viewed Products Aggregated Monthly">
<column xsi:type="int" name="id" unsigned="true" nullable="false" identity="true" comment="ID"/>
<column xsi:type="date" name="period" comment="Period"/>
<column xsi:type="smallint" name="store_id" unsigned="true" nullable="true" identity="false"
comment="Store ID"/>
<column xsi:type="int" name="product_id" unsigned="true" nullable="true" identity="false"
comment="Product ID"/>
<column xsi:type="varchar" name="product_name" nullable="true" length="255" comment="Product Name"/>
<column xsi:type="decimal" name="product_price" scale="4" precision="12" unsigned="false" nullable="false"
default="0" comment="Product Price"/>
<column xsi:type="int" name="views_num" unsigned="false" nullable="false" identity="false"
default="0" comment="Number of Views"/>
<column xsi:type="smallint" name="rating_pos" unsigned="true" nullable="false" identity="false"
default="0" comment="Rating Pos"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="id"/>
</constraint>
<constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_MONTHLY_STORE_ID_STORE_STORE_ID"
table="report_viewed_product_aggregated_monthly" column="store_id" referenceTable="store"
referenceColumn="store_id" onDelete="CASCADE"/>
<constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRD_AGGRED_MONTHLY_PRD_ID_CAT_PRD_ENTT_ENTT_ID"
table="report_viewed_product_aggregated_monthly" column="product_id"
referenceTable="catalog_product_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
<constraint xsi:type="unique" referenceId="REPORT_VIEWED_PRD_AGGRED_MONTHLY_PERIOD_STORE_ID_PRD_ID">
<column name="period"/>
<column name="store_id"/>
<column name="product_id"/>
</constraint>
<index referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_MONTHLY_STORE_ID" indexType="btree">
<column name="store_id"/>
</index>
<index referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_MONTHLY_PRODUCT_ID" indexType="btree">
<column name="product_id"/>
</index>
</table>
<table name="report_viewed_product_aggregated_yearly" resource="default" engine="innodb"
comment="Most Viewed Products Aggregated Yearly">
<column xsi:type="int" name="id" unsigned="true" nullable="false" identity="true" comment="ID"/>
<column xsi:type="date" name="period" comment="Period"/>
<column xsi:type="smallint" name="store_id" unsigned="true" nullable="true" identity="false"
comment="Store ID"/>
<column xsi:type="int" name="product_id" unsigned="true" nullable="true" identity="false"
comment="Product ID"/>
<column xsi:type="varchar" name="product_name" nullable="true" length="255" comment="Product Name"/>
<column xsi:type="decimal" name="product_price" scale="4" precision="12" unsigned="false" nullable="false"
default="0" comment="Product Price"/>
<column xsi:type="int" name="views_num" unsigned="false" nullable="false" identity="false"
default="0" comment="Number of Views"/>
<column xsi:type="smallint" name="rating_pos" unsigned="true" nullable="false" identity="false"
default="0" comment="Rating Pos"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="id"/>
</constraint>
<constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_YEARLY_STORE_ID_STORE_STORE_ID"
table="report_viewed_product_aggregated_yearly" column="store_id" referenceTable="store"
referenceColumn="store_id" onDelete="CASCADE"/>
<constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRD_AGGRED_YEARLY_PRD_ID_CAT_PRD_ENTT_ENTT_ID"
table="report_viewed_product_aggregated_yearly" column="product_id"
referenceTable="catalog_product_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
<constraint xsi:type="unique" referenceId="REPORT_VIEWED_PRD_AGGRED_YEARLY_PERIOD_STORE_ID_PRD_ID">
<column name="period"/>
<column name="store_id"/>
<column name="product_id"/>
</constraint>
<index referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_YEARLY_STORE_ID" indexType="btree">
<column name="store_id"/>
</index>
<index referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_YEARLY_PRODUCT_ID" indexType="btree">
<column name="product_id"/>
</index>
</table>
</schema>