I have implemented a system in my internal server
When insert record there is a current date field which is the timestamp and by default is the current time.
It works fine on local server until recently I need to move the database to Amazon RDS, it is set UTC instead of UTC + 8.
So , instead of changing every query in my models PHP , are there any more convenient way to adapt the changes?
I am using codeigniter and after some searching , it suggest using procedure like this:
Amazon RDS - are there workarounds to change a database time zone in SQL Server?
DELIMITER |
CREATE PROCEDURE mysql.init_connect_procedure ()
IF NOT(POSITION(‘rdsadmin@’ IN user()) = 1)
THEN SET SESSION time_zone = 'America/New_York';
END IF |
DELIMITER ;
The problem is it that need to be call everytime I run the query? so that how to modify the codeigniter Model class to run that?
Thanks a lot.