[SCHEMA] Improve timestamp storage

Avoid the use of deprecated MariaDB "zero dates" globally. If they're present
as attribute defaults somewhere, they will be replaced with NULL implicitly.
The existing "zero dates" in MariaDB storage will be left intact and this
should not present any issues.

The "timestamp" type in table definitions now corresponds to DATETIME in
MariaDB with "DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", which
should be close enough to the original behaviour for compatibility purposes.
It is now the recommended type for "modified" attributes, because of the
update trigger on MariaDB. But there is no such trigger implemented on
PostgreSQL as of this moment.
This commit is contained in:
Alexei Sorokin
2020-06-29 01:41:46 +03:00
committed by Diogo Peralta Cordeiro
parent eb993df072
commit 26115482ef
73 changed files with 1130 additions and 756 deletions

View File

@@ -63,8 +63,8 @@ class Ostatus_profile extends Managed_DataObject
'feeduri' => array('type' => 'varchar', 'length' => 191),
'salmonuri' => array('type' => 'varchar', 'length' => 191),
'avatar' => array('type' => 'text'),
'created' => array('type' => 'datetime', 'not null' => true),
'modified' => array('type' => 'datetime', 'not null' => true),
'created' => array('type' => 'datetime'),
'modified' => array('type' => 'timestamp', 'not null' => true),
),
'primary key' => array('uri'),
'unique keys' => array(