下面是使用程序创建数据表的关键代码
D:\www\lollicupStore2\app\code\local\Lollicupstore\Paymentpaypal\etc\config.xml
<global>
<blocks>
<mofluid_paymentpaypal>
<class>Mofluid_Paymentpaypal_Block</class>
</mofluid_paymentpaypal>
</blocks>
<helpers>
<mofluid_paymentpaypal>
<class>Mofluid_Paymentpaypal_Helper</class>
</mofluid_paymentpaypal>
</helpers>
<models>
<mofluid_paymentpaypal>
<class>Mofluid_Paymentpaypal_Model</class>
<resourceModel>mofluid_paymentpaypal_mysql4</resourceModel>
</mofluid_paymentpaypal>
<mofluid_paymentpaypal_mysql4>
<class>Mofluid_Paymentpaypal_Model_Mysql4</class>
<entities>
<payment>
<table>mofluidpayment</table>
</payment>
</entities>
</mofluid_paymentpaypal_mysql4>
</models>
<resources>
<mofluid_paymentpaypal_setup>
<setup>
<module>Mofluid_Paymentpaypal</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</mofluid_paymentpaypal_setup>
<mofluid_paymentpaypal_write>
<connection>
<use>core_write</use>
</connection>
</mofluid_paymentpaypal_write>
<mofluid_paymentpaypal_read>
<connection>
<use>core_read</use>
</connection>
</mofluid_paymentpaypal_read>
</resources>
</global>
D:\www\lollicupStore2\app\code\local\Lollicupstore\Paymentpaypal\sql\lollicupstore_paymentpaypal_setup\mysql4-install-1.0.php
<?php
/**
* Created by PhpStorm.
* User: lollicup
* Date: 2019/5/20
* Time: 17:38
*/
$installer = $this;
$installer->startSetup();
$installer->run("
CREATE TABLE IF NOT EXISTS {$this->getTable('lollicupstore_paymentpaypal/payment')} (
`payment_method_id` int(11) unsigned NOT NULL,
`payment_method_title` varchar(63) default '',
`payment_method_code` varchar(63) default '',
`payment_method_order_code` varchar(200) default '',
`payment_method_status` int(11) NOT NULL default 0,
`payment_method_mode` int(11) NOT NULL default 0,
`payment_method_account_id` varchar(63) NOT NULL default '',
`payment_method_account_key` varchar(63) NOT NULL default '',
`payment_account_email` varchar(63) default '',
PRIMARY KEY (`payment_method_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO {$this->getTable('lollicupstore_paymentpaypal/payment')}
(
`payment_method_id`,
`payment_method_title`,
`payment_method_code`,
`payment_method_status`,
`payment_method_mode`
)
VALUES (
1,
'Paypal Standard',
'paypal',
0,
0
);
");
$installer->endSetup();
https://blog.magestore.com/upgrade-magento-module-creating-installer-script/