diff --git a/src/application/migrations/012_legal_contents.php b/src/application/migrations/012_legal_contents.php index 59ccfacf..0bae57bf 100644 --- a/src/application/migrations/012_legal_contents.php +++ b/src/application/migrations/012_legal_contents.php @@ -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), diff --git a/src/application/models/Consents_model.php b/src/application/models/Consents_model.php index 399706a2..a9bca67a 100644 --- a/src/application/models/Consents_model.php +++ b/src/application/models/Consents_model.php @@ -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.'); diff --git a/src/assets/sql/structure.sql b/src/assets/sql/structure.sql index e8d2d8b4..8c77109c 100644 --- a/src/assets/sql/structure.sql +++ b/src/assets/sql/structure.sql @@ -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),