[CORE][DATABASE] Replace zero dates with CURRENT_TIMESTAMP and add defaults to all 'created' or 'modified'

This commit is a port from v2's 9a515b9234 ([SCHEMA] Improve timestamp storage) to v3.

As explained by Alexei Sorokin:

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

The "timestamp" type in table definitions now corresponds to DATETIME in
MariaDATABASE 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 MariaDATABASE. But there is no such trigger implemented on
PostgreSQL as of this moment.
This commit is contained in:
Hugo Sales 2020-07-05 13:12:35 +00:00 committed by Hugo Sales
parent 25aeac80a3
commit 5eae3dc351
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0
32 changed files with 60 additions and 60 deletions

View File

@ -37,7 +37,7 @@ use Functional as F;
class SchemaDefDriver extends StaticPHPDriver
{
/**
* PEAR DB type => Doctrine type
* V2 DB type => Doctrine type
*/
private const types = [
'varchar' => 'string',
@ -50,6 +50,7 @@ class SchemaDefDriver extends StaticPHPDriver
'numeric' => 'decimal',
'text' => 'text',
'datetime' => 'datetime',
'timestamp' => 'datetime',
// Unused in V2, but might start being used
'date' => 'date',
'time' => 'time',
@ -98,8 +99,7 @@ class SchemaDefDriver extends StaticPHPDriver
}
}
$default = (($opts['default'] ?? null) === '0000-00-00 00:00:00' && $_ENV['DBMS'] === 'postgres')
? '-infinity' : $opts['default'] ?? null;
$default = $opts['default'] ?? null;
$field = [
// boolean, optional

View File

@ -124,7 +124,7 @@ class ActivityLocation
'lon' => ['type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'longitude'],
'location_id' => ['type' => 'int', 'description' => 'location id if possible'],
'location_service' => ['type' => 'int', 'size' => 'tiny', 'description' => 'service used to retrieve location information'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['activity_id'],
'foreign keys' => [

View File

@ -122,8 +122,8 @@ class ActivitySource
'code' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'code identifier'],
'name' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'name of the source'],
'url' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'url to link to'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['code'],
];

View File

@ -86,7 +86,7 @@ class ActivityTag
'fields' => [
'tag' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this activity'],
'activity_id' => ['type' => 'int', 'not null' => true, 'description' => 'activity tagged'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
],
'primary key' => ['tag', 'activity_id'],
'foreign keys' => [

View File

@ -148,8 +148,8 @@ class Avatar
'width' => ['type' => 'int', 'not null' => true, 'description' => 'image width'],
'height' => ['type' => 'int', 'not null' => true, 'description' => 'image height'],
'mediatype' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'file type'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['profile_id', 'width', 'height'],
'foreign keys' => [

View File

@ -149,8 +149,8 @@ class ConfirmAddress
'address_extra' => ['type' => 'varchar', 'length' => 191, 'description' => 'carrier ID, for SMS'],
'address_type' => ['type' => 'varchar', 'length' => 8, 'not null' => true, 'description' => 'address type ("email", "xmpp", "sms")'],
'claimed' => ['type' => 'datetime', 'description' => 'date this was claimed for queueing'],
'sent' => ['type' => 'datetime', 'description' => 'date this was sent for queueing'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'sent' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this was sent for queueing'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['code'],
'foreign keys' => [

View File

@ -108,8 +108,8 @@ class Conversation
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'Unique identifier, (again) unrelated to notice id since 2016-01-06'],
'uri' => ['type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'URI of the conversation'],
'url' => ['type' => 'varchar', 'length' => 191, 'description' => 'Resolvable URL, preferably remote (local can be generated on the fly)'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['id'],
'unique keys' => [

View File

@ -215,7 +215,7 @@ class File
'is_local' => ['type' => 'bool', 'description' => 'whether the file is stored locally'],
'width' => ['type' => 'int', 'description' => 'width in pixels, if it can be described as such and data is available'],
'height' => ['type' => 'int', 'description' => 'height in pixels, if it can be described as such and data is available'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['id'],
'unique keys' => [

View File

@ -134,7 +134,7 @@ class FileThumbnail
'file_id' => ['type' => 'int', 'not null' => true, 'description' => 'thumbnail for what file'],
'width' => ['type' => 'int', 'not null' => true, 'description' => 'width of thumbnail'],
'height' => ['type' => 'int', 'not null' => true, 'description' => 'height of thumbnail'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['file_id', 'width', 'height'],
'foreign keys' => [

View File

@ -85,7 +85,7 @@ class FileToActivity
'fields' => [
'file_id' => ['type' => 'int', 'not null' => true, 'description' => 'id of file'],
'activity_id' => ['type' => 'int', 'not null' => true, 'description' => 'id of the activity it belongs to'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['file_id', 'activity_id'],
'foreign keys' => [

View File

@ -86,7 +86,7 @@ class FollowQueue
'fields' => [
'follower' => ['type' => 'int', 'not null' => true, 'description' => 'remote or local profile making the request'],
'followed' => ['type' => 'int', 'not null' => true, 'description' => 'remote or local profile being followed to'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
],
'primary key' => ['follower', 'followed'],
'indexes' => [

View File

@ -263,12 +263,12 @@ class Group
'homepage_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'homepage (profile) size logo'],
'stream_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'stream-sized logo'],
'mini_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'mini logo'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'],
'mainpage' => ['type' => 'varchar', 'length' => 191, 'description' => 'page for group info to link to'],
'join_policy' => ['type' => 'int', 'size' => 'tiny', 'description' => '0=open; 1=requires admin approval'],
'force_scope' => ['type' => 'int', 'size' => 'tiny', 'description' => '0=never,1=sometimes,-1=always'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['id'],
'unique keys' => [

View File

@ -85,7 +85,7 @@ class GroupAlias
'fields' => [
'alias' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'additional nickname for the group'],
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'group id which this is an alias of'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date alias was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['alias'],
'foreign keys' => [

View File

@ -98,7 +98,7 @@ class GroupBlock
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'],
'blocked_profile' => ['type' => 'int', 'not null' => true, 'description' => 'profile that is blocked'],
'blocker_user' => ['type' => 'int', 'not null' => true, 'description' => 'user making the block'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date of blocking'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['group_id', 'blocked_profile'],
'foreign keys' => [

View File

@ -86,7 +86,7 @@ class GroupInbox
'fields' => [
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'group receiving the message'],
'activity_id' => ['type' => 'int', 'not null' => true, 'description' => 'activity received'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the activity was created'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
],
'primary key' => ['group_id', 'activity_id'],
'foreign keys' => [

View File

@ -86,7 +86,7 @@ class GroupJoinQueue
'fields' => [
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'remote or local profile making the request'],
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'remote or local group to join, if any'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
],
'primary key' => ['profile_id', 'group_id'],
'indexes' => [

View File

@ -123,8 +123,8 @@ class GroupMember
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
'is_admin' => ['type' => 'bool', 'default' => false, 'description' => 'is this user an admin?'],
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['group_id', 'profile_id'],
'unique keys' => [

View File

@ -123,8 +123,8 @@ class Invitation
'user_id' => ['type' => 'int', 'not null' => true, 'description' => 'who sent the invitation'],
'address' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'invitation sent to'],
'address_type' => ['type' => 'varchar', 'length' => 8, 'not null' => true, 'description' => 'address type ("email", "xmpp", "sms")'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'registered_user_id' => ['type' => 'int', 'not null' => false, 'description' => 'if the invitation is converted, who the new user is'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
],
'primary key' => ['code'],
'foreign keys' => [

View File

@ -97,8 +97,8 @@ class LocationService
'fields' => [
'id' => ['type' => 'int', 'size' => 'tiny', 'not null' => true, 'description' => 'identifier for the location service'],
'description' => ['type' => 'varchar', 'length' => 191, 'description' => 'description of the service'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['id'],
];

View File

@ -111,8 +111,8 @@ class Notification
'notice_id' => ['type' => 'int', 'not null' => true, 'description' => 'notice_id to give attention'],
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'profile_id for feed receiver'],
'reason' => ['type' => 'varchar', 'length' => 191, 'description' => 'Optional reason why this was brought to the attention of profile_id'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['notice_id', 'profile_id'],
'foreign keys' => [

View File

@ -214,8 +214,8 @@ class Profile
'lon' => ['type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'longitude'],
'location_id' => ['type' => 'int', 'description' => 'location id if possible'],
'location_service' => ['type' => 'int', 'description' => 'service used to obtain location id'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['id'],
'indexes' => [

View File

@ -85,7 +85,7 @@ class ProfileBlock
'fields' => [
'blocker' => ['type' => 'int', 'not null' => true, 'description' => 'user making the block'],
'blocked' => ['type' => 'int', 'not null' => true, 'description' => 'profile that is blocked'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date of blocking'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['blocker', 'blocked'],
'foreign keys' => [

View File

@ -189,8 +189,8 @@ class ProfileList
'mainpage' => ['type' => 'varchar', 'length' => 191, 'description' => 'page to link to'],
'tagged_count' => ['type' => 'int', 'default' => 0, 'description' => 'number of people tagged with this tag by this user'],
'follower_count' => ['type' => 'int', 'default' => 0, 'description' => 'number of followers to this tag'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the tag was added'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['tagger', 'tag'],
'unique keys' => [

View File

@ -123,8 +123,8 @@ class ProfilePrefs
'namespace' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'namespace, like pluginname or category'],
'topic' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'preference key, i.e. description, age...'],
'data' => ['type' => 'blob', 'description' => 'topic data, may be anything'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['profile_id', 'namespace', 'topic'],
'foreign keys' => [

View File

@ -98,7 +98,7 @@ class ProfileTag
'tagger' => ['type' => 'int', 'not null' => true, 'description' => 'user making the tag'],
'tagged' => ['type' => 'int', 'not null' => true, 'description' => 'profile tagged'],
'tag' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this notice'],
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date the tag was added'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['tagger', 'tagged', 'tag'],
'foreign keys' => [

View File

@ -97,8 +97,8 @@ class ProfileTagFollow
'fields' => [
'profile_tag_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile_tag'],
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['profile_tag_id', 'profile_id'],
'foreign keys' => [

View File

@ -86,7 +86,7 @@ class RelatedGroup
'fields' => [
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to user_group'],
'related_group_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to user_group'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
],
'primary key' => ['group_id', 'related_group_id'],
'foreign keys' => [

View File

@ -73,7 +73,7 @@ class ReservedNickname
'description' => 'A reserved nickname',
'fields' => [
'nickname' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'nickname not to use'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
],
'primary key' => ['nickname'],
];

View File

@ -110,8 +110,8 @@ class SmsCarrier
'id' => ['type' => 'int', 'not null' => true, 'description' => 'primary key for SMS carrier'],
'name' => ['type' => 'varchar', 'length' => 64, 'description' => 'name of the carrier'],
'email_pattern' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'sprintf pattern for making an email address from a phone number'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['id'],
'unique keys' => [

View File

@ -95,8 +95,8 @@ class UserLocationPrefs
'fields' => [
'user_id' => ['type' => 'int', 'not null' => true, 'description' => 'user who has the preference'],
'share_location' => ['type' => 'bool', 'default' => true, 'description' => 'Whether to share location data'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['user_id'],
'foreign keys' => [

View File

@ -153,8 +153,8 @@ class UserNotificationPrefs
'dm' => ['type' => 'bool', 'not null' => true, 'default' => false, 'description' => 'Notify someone sends us a direct message'],
'post_on_status_change' => ['type' => 'bool', 'not null' => true, 'default' => false, 'description' => 'Post a notice when our status in service changes'],
'enable_posting' => ['type' => 'bool', 'default' => true, 'description' => 'Enable posting from this service'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['user_id', 'transport'],
'unique keys' => [

View File

@ -123,8 +123,8 @@ class UserUrlShortenerPrefs
'url_shortening_service' => ['type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'],
'max_url_length' => ['type' => 'int', 'not null' => true, 'description' => 'urls greater than this length will be shortened, 0 = always, -1 = never'],
'max_notice_length' => ['type' => 'int', 'not null' => true, 'description' => 'notices with content greater than this value will have all urls shortened, 0 = always, -1 = only if notice text is longer than max allowed'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['user_id'],
'foreign keys' => [