<?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="coursereference_prices_log" resource="default" engine="innodb" comment="Course Reference Prices Log">
        <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="ID"/>
        <column name="coursereference_id" xsi:type="int" padding="10" unsigned="true" nullable="true" comment="Course Reference ID"/>
        <column name="course_id" nullable="true" xsi:type="varchar" comment="Course ID" length="30"/>
        <column name="unit_price" nullable="true" xsi:type="decimal" scale="4" precision="12" comment="Unit Price"/>
        <column name="do_not_override" xsi:type="boolean" nullable="false" default="false" comment="Do Not Override"/>
        <column name="admin_user_id" xsi:type="int" padding="10" unsigned="true" nullable="true" comment="Admin User ID"/>
        <column name="created_at" xsi:type="timestamp" nullable="false" default="CURRENT_TIMESTAMP" comment="Created At"/>
        <column name="updated_at" xsi:type="timestamp" nullable="false" default="CURRENT_TIMESTAMP" on_update="true" comment="Updated At"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="id"/>
        </constraint>
        <constraint xsi:type="foreign" referenceId="COURSE_PRICES_LOG_ADMIN_USER_ID_ADMIN_USER_USER_ID1" table="coursereference_prices_log" column="admin_user_id" referenceTable="admin_user" referenceColumn="user_id" onDelete="SET NULL"/>
        <constraint xsi:type="foreign" referenceId="COURSE_PRICES_LOG_CR_ID_CR_CR_ID" table="coursereference_prices_log" column="coursereference_id" referenceTable="coursereference" referenceColumn="coursereference_id" onDelete="CASCADE"/>
    </table>

    <table name="coursereference_sync_log" resource="default" engine="innodb" comment="Course Reference Sync Log">
        <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="ID"/>
        <column name="coursereference_id" xsi:type="int" padding="10" unsigned="true" nullable="true" comment="Course Reference ID"/>
        <column name="course_id" nullable="false" xsi:type="varchar" comment="Course ID" length="30"/>
        <column name="old_price" nullable="true" xsi:type="decimal" scale="4" precision="12" comment="Old Price"/>
        <column name="new_price" nullable="true" xsi:type="decimal" scale="4" precision="12" comment="New Price"/>
        <column name="action" nullable="false" xsi:type="varchar" comment="Action" length="100"/>
        <column name="created_at" xsi:type="timestamp" nullable="false" default="CURRENT_TIMESTAMP" comment="Created At"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="id"/>
        </constraint>
    </table>
</schema>
