Change ea_consents table creation and management for backward compatibility (#518]

This change allows the creation and migration scripts to run on MySQL/MariaDB 5.5.x versions (still the default version for Linux RHEL/CentOS 7.x versions).
This commit is contained in:
oxteam 2018-07-10 15:51:42 +02:00
parent a1647966db
commit 3dde409f72
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

@ -23,9 +23,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),