title: MySQL not executing CURRENT_TIMESTAMP updates as expected
body: <p>After lots of research and several similar questions asked <a href="https://stackoverflow.com/questions/51245247/mysql-not-updating-the-updated-at-column">here</a>, I have reached some conclusions, but as always it is, there are more questions.</p>
  
  <p>This concerns the <a href="https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html" rel="nofollow noreferrer">explicit_defaults_for_timestamp</a></p>
  
  <p>Assuming the <strong>explicit_defaults_for_timestamp</strong> is turned off, this will work:</p>
  
  <p>Schema:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `updated_tables` (
    `table_name` VARCHAR(50) NOT NULL,
    `updated_at` TIMESTAMP(6)  NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    PRIMARY KEY (`table_name`),
    UNIQUE INDEX `table_name_UNIQUE` (`table_name` ASC))
    ENGINE = InnoDB;
  </code></pre>
  
  <p>And the query:</p>
  
  <pre><code>INSERT INTO `updated_tables` (`table_name`,`updated_at`) VALUES ('products',NULL) ON DUPLICATE KEY UPDATE `table_name`=VALUES(`table_name`), `updated_at`=VALUES(`updated_at`);
  </code></pre>
  
  <p>First time the query is sent, the table is populated with 'products' and with the current time stamp.
  If I repeat the query, then the field 'updated_at' is updated. Per definition, when I send NULL value, even though it is not allowed, the MySQL will update the column. 
  All is fine, and works as expected.</p>
  
  <p>Lets assume I turn on the <strong>explicit_defaults_for_timestamp</strong>
  If I user the above query, it will complain the the NULL is not allowed, which complies with the rules.</p>
  
  <p>Question is, how can I have the same functionality with the <strong>explicit_defaults_for_timestamp</strong> turned on?
  There is the solution to introduce additional column (varchar) which holds for example timestamp in miliseconds. And when I update it, then the MySQL updates the updated_at accordingly.
  But it looks like an overkill, I might as well update the updated_at manually. I would like to move that responsibility to MySQL level, not doing it programatically.</p>
  
  <p>In short, how can I perform updates on the table_name, and have the updated_at being set properly. The trick here is I have many updates (cache table), but actually never changing the table_name value at all.</p>
  
  <p>Is it possible? Or I must turn off explicit_defaults_for_timestamp?</p>
  
  <p>Is it bad decision to turn it off? Looking at this <a href="https://forums.aws.amazon.com/thread.jspa?threadID=132676" rel="nofollow noreferrer">AWS RDS</a> post seems it is ok, but I am not sure. </p>
  
  <p>Side question:</p>
  
  <p>If I decide to perform updates on my own, what would be the way to construct it?
  Currently the MySQL CURRENT_TIMESTAMP(6) has this construct:
  <strong>2018-07-10 11:32:43.490100</strong>
  How could I create same construct with Javascript? First thing coming to my mind is to get current Date, and append to it last 6 digits of current timestamp.</p>