Merge pull request #522 from oxteam/oxteam-fix_gpdr_sql_backward_comp

Fix MySQL/MariaDB 5.5.x  backward compatibility issue with 'ea_consents' table (#518)
This commit is contained in:
Alex Tselegidis 2020-03-09 21:49:46 +01:00 committed by GitHub
commit bd45947a42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View file

@ -25,9 +25,9 @@ class Migration_Legal_contents extends CI_Migration {
$this->db->query('
CREATE TABLE IF NOT EXISTS `ea_consents` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`created` DATETIME DEFAULT CURRENT_TIMESTAMP,
`modified` DATETIME DEFAULT CURRENT_TIMESTAMP
`modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
`created` TIMESTAMP,
`first_name` VARCHAR(256),
`last_name` VARCHAR(256),
`email` VARCHAR(512),

View file

@ -74,6 +74,7 @@ class Consents_model extends CI_Model {
*/
protected function _insert($consent)
{
$this->db->set('created', 'NOW()', FALSE);
if ( ! $this->db->insert('ea_consents', $consent))
{
throw new Exception('Could not insert consent to the database.');

View file

@ -24,9 +24,9 @@ CREATE TABLE IF NOT EXISTS `ea_appointments` (
CREATE TABLE IF NOT EXISTS `ea_consents` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`created` DATETIME DEFAULT CURRENT_TIMESTAMP,
`modified` DATETIME DEFAULT CURRENT_TIMESTAMP
`modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
`created` TIMESTAMP,
`first_name` VARCHAR(256),
`last_name` VARCHAR(256),
`email` VARCHAR(512),