浏览文章

文章信息

Magento2 db_schema.xml,int,varchar,decimal,text|添加价格字段 14212

实例

<?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="sales_shipment_item" resource="sales" engine="innodb" comment="Sales Flat Shipment Item">
        <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Entity Id"/>
        <column xsi:type="int" name="parent_id" padding="10" unsigned="true" nullable="false" identity="false" comment="Parent Id"/>
        <column xsi:type="decimal" name="row_total" scale="4" precision="20" unsigned="false" nullable="true" comment="Row Total"/>
        <column xsi:type="decimal" name="price" scale="4" precision="20" unsigned="false" nullable="true" comment="Price"/>
        <column xsi:type="decimal" name="weight" scale="4" precision="12" unsigned="false" nullable="true" comment="Weight"/>
        <column xsi:type="decimal" name="qty" scale="4" precision="12" unsigned="false" nullable="true" comment="Qty"/>
        <column xsi:type="int" name="product_id" padding="11" unsigned="false" nullable="true" identity="false" comment="Product Id"/>
        <column xsi:type="int" name="order_item_id" padding="11" unsigned="false" nullable="true" identity="false" comment="Order Item Id"/>
        <column xsi:type="text" name="additional_data" nullable="true" comment="Additional Data"/>
        <column xsi:type="text" name="description" nullable="true" comment="Description"/>
        <column xsi:type="varchar" name="name" nullable="true" length="255" comment="Name"/>
        <column xsi:type="varchar" name="sku" nullable="true" length="255" comment="Sku"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="entity_id"/>
        </constraint>
        <constraint xsi:type="foreign" referenceId="SALES_SHIPMENT_ITEM_PARENT_ID_SALES_SHIPMENT_ENTITY_ID"
                    table="sales_shipment_item" column="parent_id" referenceTable="sales_shipment"
                    referenceColumn="entity_id" onDelete="CASCADE"/>
        <index referenceId="SALES_SHIPMENT_ITEM_PARENT_ID" indexType="btree">
            <column name="parent_id"/>
        </index>
    </table>
 
</schema>


原创