mage4 / magento2-run-sql
Magento 扩展,可直接从控制台命令运行 SQL 查询。
1.0.0
2023-07-12 12:24 UTC
Requires
- php: >=7.2
- magento/framework: >=102.0.7
README
Magento 扩展,可直接从控制台命令运行 SQL 查询。
使用 composer 安装
composer require mage4/magento2-run-sql
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
手动复制粘贴安装包
从以下目录下载此存储库中的代码,在 Magento® 2 中
app/code/Mage4/RunSql
运行以下命令以启用模块
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
功能
- 执行 DDL 查询。
- 执行 DML 查询。
- 执行 DQL 查询。
示例
- 从
store
表中选择记录
bin/magento mage4:run-sql "select * from store"
- 向
store
表中插入记录
bin/magento mage4:run-sql 'insert into store (code, website_id, group_id, name, sort_order, is_
active) VALUES ("test", 1, 1, "Test Store", 0, 0)'
- 从
store
表中删除记录
bin/magento mage4:run-sql "delete from store where store_id=5"
- 获取
store
表的架构
bin/magento mage4:run-sql "describe store" -f
关于我们
我们是一家创新型开发机构,使用最新技术构建出色的网站、网店和 Web 应用程序。访问我们的网站 mage4.com 或 发送电子邮件。