peatio icon indicating copy to clipboard operation
peatio copied to clipboard

MySQL database collation needs to be set on database.yml

Open myujang opened this issue 8 years ago • 2 comments

Test from docker workbench.

docker-compose run --rm peatio "./bin/setup"

database.yml default: &default adapter: mysql2 encoding: utf8 pool: 5 host: <%= ENV['DATABASE_HOST'] %> username: <%= ENV['DATABASE_USER'] %> password: <%= ENV['DATABASE_PASS'] %>

SQL (0.7ms) INSERT INTO currencies (id, code, key, symbol, base_factor, quick_withdraw_limit, options, created_at, updated_at) VALUES (2, 'btc', 'satoshi', '฿', 100000000, 0.1, '{"api_client":"BTC","json_rpc_endpoint":"http://user:[email protected]:18332","bitgo_test_net":true,"bitgo_wallet_id":null,"bitgo_wallet_address":null,"bitgo_wallet_passphrase":null,"bitgo_rest_api_root":"https://test.bitgo.com/api/v2","bitgo_rest_api_access_token":null,"wallet_url_template":"https://blockchain.info/address/#{address}","transaction_url_template":"https://blockchain.info/tx/#{txid}"}', '2018-03-10 09:28:39', '2018-03-10 09:28:39') (2.2ms) ROLLBACK rake aborted! ActiveRecord::StatementInvalid: Mysql2::Error: Incorrect string value: '\xE0\xB8\xBF' for column 'symbol' at row 1: INSERT INTO currencies (id, code, key, symbol, base_factor, quick_withdraw_limit, options, created_at, updated_at) VALUES (2, 'btc', 'satoshi', '฿', 100000000, 0.1, '{"api_client":"BTC","json_rpc_endpoint":"http://user:[email protected]:18332","bitgo_test_net":true,"bitgo_wallet_id":null,"bitgo_wallet_address":null,"bitgo_wallet_passphrase":null,"bitgo_rest_api_root":"https://test.bitgo.com/api/v2","bitgo_rest_api_access_token":null,"wallet_url_template":"https://blockchain.info/address/#{address}","transaction_url_template":"https://blockchain.info/tx/#{txid}"}', '2018-03-10 09:28:39', '2018-03-10 09:28:39')

This error due to character string not compatible with the existing collation. So i add collation to database.yml default: &default adapter: mysql2 encoding: utf8 collation: utf8_general_ci pool: 5 host: <%= ENV['DATABASE_HOST'] %> username: <%= ENV['DATABASE_USER'] %> password: <%= ENV['DATABASE_PASS'] %>

After that re-run again setup. The insert from currencies.yml should be inserted properly.

Currency Exists (0.3ms) SELECT 1 AS one FROM currencies WHERE currencies.code = 'btc' LIMIT 1 Currency Exists (0.4ms) SELECT 1 AS one FROM currencies WHERE currencies.code = BINARY 'btc' LIMIT 1 SQL (0.4ms) INSERT INTO currencies (id, code, key, symbol, base_factor, quick_withdraw_limit, options, created_at, updated_at) VALUES (2, 'btc', 'satoshi', '฿', 100000000, 0.1, '{"api_client":"BTC","json_rpc_endpoint":"http://user:[email protected]:18332","bitgo_test_net":true,"bitgo_wallet_id":null,"bitgo_wallet_address":null,"bitgo_wallet_passphrase":null,"bitgo_rest_api_root":"https://test.bitgo.com/api/v2","bitgo_rest_api_access_token":null,"wallet_url_template":"https://blockchain.info/address/#{address}","transaction_url_template":"https://blockchain.info/tx/#{txid}"}', '2018-03-10 09:37:05', '2018-03-10 09:37:05')

myujang avatar Mar 10 '18 09:03 myujang

Hi @myujang

Thank you for the report. I agree we need this. Added to TODO list.

yivo avatar Mar 10 '18 11:03 yivo

Closed via #688.

yivo avatar Mar 19 '18 11:03 yivo