【问题标题】:can not create db_schema_whitelist.json file in magento 2.4.4无法在 magento 2.4.4 中创建 db_schema_whitelist.json 文件
【发布时间】:2022-12-29 20:57:51
【问题描述】:

我在从 xml 模式创建自定义 mysql 表时遇到问题。

我已经创建了 app/code/Vendor_Name/Module_Name/etc/db_schema.xml

db_schema.xml

<?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="test_table" resource="default" engine="innodb" comment="Test blog table">
        <column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true"
                comment="Entity ID"/>
        <column xsi:type="varchar" name="title" length="70" nullable="false" comment="Title"/>
        <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP"
                comment="Creation Time"/>
        <column xsi:type="timestamp" name="updated_at" on_update="true" nullable="false" default="CURRENT_TIMESTAMP"
                comment="Update Time"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="entity_id"/>
        </constraint>
   </table>
</schema>

在此之后我没有错误地执行 CLI 但无法在中创建 db_schema_whitelist.json供应商名称/模块名称/等文件夹

php bin/magento setup:db-declaration:generate-whitelist --module-name=VendorName_ModuleName

我的 vendor_Name/Module_Name 已经使能够

我做什么请帮忙!!!

【问题讨论】:

    标签: php mysql magento2.4


    【解决方案1】:

    我使用你的 db_schema.xml 并运行下面的命令来创建 db_schema_whitelist.json

    php bin/magento setup:db-declaration:generate-whitelist --module-name=MagentoCoders_SizeChart

    根据白名单的 CLI 命令

    php bin/magento setup:db-declaration:generate-whitelist --module-name=VendorName_ModuleName

    并且我在 magento 2.4.4 中成功生成了 db_schema_whitelist.json 文件。
    请找出 db_schema_whitelist 文件附件

    CLI COMMAND

    db_schema_whitelist

    db_schema

    【讨论】:

      猜你喜欢
      • 2018-04-18
      • 1970-01-01
      • 2022-07-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-20
      • 2022-09-30
      • 2019-09-23
      • 1970-01-01
      相关资源
      最近更新 更多