salix/db/dump/mockDate.sql

43 lines
801 B
MySQL
Raw Normal View History

2022-06-09 11:33:01 +00:00
CREATE SCHEMA IF NOT EXISTS `util`;
USE `util`;
DELIMITER ;;
DROP FUNCTION IF EXISTS `util`.`mockedDate`;
2023-01-16 14:18:00 +00:00
CREATE FUNCTION `util`.`mockedDate`()
2022-06-09 11:33:01 +00:00
RETURNS DATETIME
DETERMINISTIC
BEGIN
2023-02-02 13:52:40 +00:00
RETURN CONVERT_TZ('2001-01-01 11:00:00', 'utc', 'Europe/Madrid');
2022-06-09 11:33:01 +00:00
END ;;
DELIMITER ;
DELIMITER ;;
DROP FUNCTION IF EXISTS `util`.`VN_CURDATE`;
2023-01-16 14:18:00 +00:00
CREATE FUNCTION `util`.`VN_CURDATE`()
2022-06-09 11:33:01 +00:00
RETURNS DATE
DETERMINISTIC
BEGIN
RETURN DATE(mockedDate());
END ;;
DELIMITER ;
DELIMITER ;;
DROP FUNCTION IF EXISTS `util`.`VN_CURTIME`;
2023-01-16 14:18:00 +00:00
CREATE FUNCTION `util`.`VN_CURTIME`()
2022-06-09 11:33:01 +00:00
RETURNS TIME
DETERMINISTIC
BEGIN
RETURN TIME(mockedDate());
END ;;
DELIMITER ;
DELIMITER ;;
DROP FUNCTION IF EXISTS `util`.`VN_NOW`;
2023-01-16 14:18:00 +00:00
CREATE FUNCTION `util`.`VN_NOW`()
2022-06-09 11:33:01 +00:00
RETURNS DATETIME
DETERMINISTIC
BEGIN
2023-01-16 14:18:00 +00:00
RETURN mockedDate();
2022-06-09 11:33:01 +00:00
END ;;
2023-01-16 14:18:00 +00:00
DELIMITER ;