Skip to content

Commit

Permalink
Fix issue #25 (Field 'created_time' doesn't have a default value)
Browse files Browse the repository at this point in the history
  • Loading branch information
wubenqi committed Apr 15, 2018
1 parent 680c9b3 commit c2278f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions biz/core/auth/phone_code_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ func (code *phoneCodeData) DoSendCode(phoneRegistered, allowFlashCall, currentNu
State: kCodeStateSent,
ApiId: apiId,
ApiHash: apiHash,
CreatedTime: time.Now().Unix(),
}
code.tableId = dao.GetAuthPhoneTransactionsDAO(dao.DB_MASTER).Insert(do)
//// TODO(@benqi):
Expand Down
4 changes: 2 additions & 2 deletions biz/dal/dao/mysql_dao/auth_phone_transactions_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ func NewAuthPhoneTransactionsDAO(db *sqlx.DB) *AuthPhoneTransactionsDAO {
return &AuthPhoneTransactionsDAO{db}
}

// insert into auth_phone_transactions(auth_key_id, phone_number, code, code_expired, transaction_hash, sent_code_type, flash_call_pattern, next_code_type, state, api_id, api_hash) values (:auth_key_id, :phone_number, :code, :code_expired, :transaction_hash, :sent_code_type, :flash_call_pattern, :next_code_type, :state, :api_id, :api_hash)
// insert into auth_phone_transactions(auth_key_id, phone_number, code, code_expired, transaction_hash, sent_code_type, flash_call_pattern, next_code_type, state, api_id, api_hash, created_time) values (:auth_key_id, :phone_number, :code, :code_expired, :transaction_hash, :sent_code_type, :flash_call_pattern, :next_code_type, :state, :api_id, :api_hash, :created_time)
// TODO(@benqi): sqlmap
func (dao *AuthPhoneTransactionsDAO) Insert(do *dataobject.AuthPhoneTransactionsDO) int64 {
var query = "insert into auth_phone_transactions(auth_key_id, phone_number, code, code_expired, transaction_hash, sent_code_type, flash_call_pattern, next_code_type, state, api_id, api_hash) values (:auth_key_id, :phone_number, :code, :code_expired, :transaction_hash, :sent_code_type, :flash_call_pattern, :next_code_type, :state, :api_id, :api_hash)"
var query = "insert into auth_phone_transactions(auth_key_id, phone_number, code, code_expired, transaction_hash, sent_code_type, flash_call_pattern, next_code_type, state, api_id, api_hash, created_time) values (:auth_key_id, :phone_number, :code, :code_expired, :transaction_hash, :sent_code_type, :flash_call_pattern, :next_code_type, :state, :api_id, :api_hash, :created_time)"
r, err := dao.db.NamedExec(query, do)
if err != nil {
errDesc := fmt.Sprintf("NamedExec in Insert(%v), error: %v", do, err)
Expand Down
4 changes: 2 additions & 2 deletions biz/dal/tables/auth_phone_transactions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<operation name="Insert">
<sql>
INSERT INTO auth_phone_transactions
(auth_key_id, phone_number, code, code_expired, transaction_hash, sent_code_type, flash_call_pattern, next_code_type, state, api_id, api_hash)
(auth_key_id, phone_number, code, code_expired, transaction_hash, sent_code_type, flash_call_pattern, next_code_type, state, api_id, api_hash, created_time)
VALUES
(:auth_key_id, :phone_number, :code, :code_expired, :transaction_hash, :sent_code_type, :flash_call_pattern, :next_code_type, :state, :api_id, :api_hash)
(:auth_key_id, :phone_number, :code, :code_expired, :transaction_hash, :sent_code_type, :flash_call_pattern, :next_code_type, :state, :api_id, :api_hash, :created_time)
</sql>
</operation>
<operation name="SelectByPhoneCodeHash">
Expand Down

0 comments on commit c2278f0

Please sign in to comment.