无法更新推进中的主键字段值

esyap4oy  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(208)

我正在尝试更新作为主键字段的行项的字段值。表格结构如下。

mysql> desc sms_service_settings;
+-----------------------------+------------------------------+------+-----+-----------+-------+
| Field                       | Type                         | Null | Key | Default  
+-----------------------------+------------------------------+------+-----+--------
| customer_id                 | int(11) unsigned             | NO   | PRI | NULL 
| daily_limit                 | decimal(8,2)                 | YES  |     | NULL 
| account_type                | enum('Post-paid','Pre-paid') | NO   |     | Post-paid
| credit_amount               | double(8,4)                  | YES  |     | NULL 
+-----------------------------+------------------------------+------+-----+--------

表的模式定义如下

<table name="sms_service_settings" idMethod="native" phpName="SmsServiceSettings">
    <column name="customer_id" phpName="CustomerId" type="BIGINT" primaryKey="true" required="true" defaultValue="0"/>
    <column name="daily_limit" phpName="DailyLimit" type="DECIMAL" size="8" scale="2"/>
    <column name="account_type" phpName="AccountType" type="VARCHAR" sqlType="enum('Post-paid','Pre-paid')"  size="15" defaultValue="Post-paid"/>
    <vendor type="mysql">
      <parameter name="Engine" value="MyISAM"/>
    </vendor>
  </table>

我的代码如下。

$sms_service = SmsServiceSettingsQuery::create()
                    ->findPK($original_customer_id);
$sms_service->setCustomerId($new_customer_id);
$sms_service->save();

这不会返回任何错误。但客户id未更新。有人能帮忙吗。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题