You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am using a MySQL 8.0 database.
Every time a query is executed, sqlx makes settings such as the 'sqlmode', where 'timezone=' +00:00 '' can lead to time zone issues.
I reside in the Eastern Standard Time (EST) zone, and my model field is set to DateTimeWithTimeZone, specifically
pub create_time: DateTimeWithTimeZone
The 'createtime' field in the database is set to the default value of CURRENTTIMESTAMP.
As a result, every time new data is added, the 'create_time' is always 8 hours behind.
I have also followed the sqlx documentation to set the timezone, and passed the MySqlConnectOptions configuration to seaorm's Database::connect method. However, it seems to have no effect. Can you assist me? Thank you.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I am using a MySQL 8.0 database.
Every time a query is executed, sqlx makes settings such as the 'sqlmode', where 'timezone=' +00:00 '' can lead to time zone issues.
I reside in the Eastern Standard Time (EST) zone, and my model field is set to DateTimeWithTimeZone, specifically
pub create_time: DateTimeWithTimeZone
The 'createtime' field in the database is set to the default value of CURRENTTIMESTAMP.
As a result, every time new data is added, the 'create_time' is always 8 hours behind.
I have also followed the sqlx documentation to set the timezone, and passed the MySqlConnectOptions configuration to seaorm's Database::connect method. However, it seems to have no effect. Can you assist me? Thank you.
this is log
2024-09-26T03:53:45.687296Z INFO sqlx::query: summary="SET sql_mode=(SELECT CONCAT(@@sql_mode, ',PIPES_AS_
CONCAT,NO_ENGINE_SUBSTITUTION')),time_zone='+00:00',NAMES …" db.statement="\n\nSET\n sql_mode =(\n SELE
CT\n CONCAT(\n @ @sql_mode,\n ',PIPES_AS_CONCAT,NO_ENGINE_SUBSTITUTION'\n )\n ),\n
time_zone = '+00:00',\n NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;\n" rows_affected=0 rows_returned=0 elapsed=11.0103ms elapsed_secs=0.0110103
my configuration information
`use sea_orm::{ColIdx, ConnectOptions, Database, DatabaseConnection, ConnectionTrait, Statement};
use sea_orm::sqlx::{ConnectOptions as sqlxConnectOptions, Execute, Executor, MySql, MySqlConnection};
use sea_orm::sqlx::mysql::{MySqlConnectOptions, MySqlPoolOptions};
let opt = MySqlConnectOptions::default()
.no_engine_subsitution(false)
.pipes_as_concat(false)
.timezone(None)
.set_names(false)
.host("127.0.0.1").port(3306)
.username("root")
.password("root")
.database("test_db").to_url_lossy();
let mut connection = Database::connect(opt)
.await.unwrap();
`
Beta Was this translation helpful? Give feedback.
All reactions