[CORE][DATABASE] Restructure the database

This commit is contained in:
Hugo Sales 2020-06-30 16:26:40 +00:00 committed by Hugo Sales
parent 44eaf43ba9
commit 25aeac80a3
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
57 changed files with 332 additions and 3049 deletions

View File

View File

@ -1,6 +1,7 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
@ -15,6 +16,7 @@
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
@ -35,7 +37,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class Notice
class Activity
{
// {{{ Autocode
@ -237,54 +239,51 @@ class Notice
public static function schemaDef(): array
{
$def = [
'name' => 'notice',
'name' => 'activity',
'fields' => [
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'who made the update'],
'id' => ['type' => 'serial', 'not null' => true],
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'who made the activity'],
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier, usually a tag URI'],
'content' => ['type' => 'text', 'description' => 'update content', 'collate' => 'utf8mb4_general_ci'],
'content' => ['type' => 'text', 'description' => 'activity content'],
'rendered' => ['type' => 'text', 'description' => 'HTML version of the content'],
'url' => ['type' => 'varchar', 'length' => 191, 'description' => 'URL of any attachment (image, video, bookmark, whatever)'],
'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'],
'reply_to' => ['type' => 'int', 'description' => 'notice replied to (usually a guess)'],
'is_local' => ['type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'notice was generated by a user'],
'source' => ['type' => 'varchar', 'length' => 32, 'description' => 'source of comment, like "web", "im", or "clientname"'],
'conversation' => ['type' => 'int', 'description' => 'the local numerical conversation id'],
'repeat_of' => ['type' => 'int', 'description' => 'notice this is a repeat of'],
'reply_to' => ['type' => 'int', 'description' => 'activity replied to (usually a guess)'],
'is_local' => ['type' => 'bool', 'description' => 'was this activity generated by a local user'],
'source' => ['type' => 'varchar', 'length' => 32, 'description' => 'source of activity, like "web", "im", or "clientname"'],
'conversation' => ['type' => 'int', 'description' => 'the local conversation id'],
'repeat_of' => ['type' => 'int', 'description' => 'activity this is a repeat of'],
'object_type' => ['type' => 'varchar', 'length' => 191, 'description' => 'URI representing activity streams object type', 'default' => null],
'verb' => ['type' => 'varchar', 'length' => 191, 'description' => 'URI representing activity streams verb', 'default' => 'http://activitystrea.ms/schema/1.0/post'],
'scope' => ['type' => 'int',
'description' => 'bit map for distribution scope; 0 = everywhere; 1 = this server only; 2 = addressees; 4 = groups; 8 = followers; 16 = messages; null = default', ],
'scope' => ['type' => 'int', 'description' => 'bit map for distribution scope; 0 = everywhere; 1 = this server only; 2 = addressees; 4 = groups; 8 = followers; 16 = messages; null = default'],
'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' => [
'notice_uri_key' => ['uri'],
'activity_uri_key' => ['uri'],
],
'foreign keys' => [
'notice_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
'notice_reply_to_fkey' => ['notice', ['reply_to' => 'id']],
'notice_conversation_fkey' => ['conversation', ['conversation' => 'id']], // note... used to refer to notice.id
'notice_repeat_of_fkey' => ['notice', ['repeat_of' => 'id']], // @fixme: what about repeats of deleted notices?
'activity_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
'activity_reply_to_fkey' => ['activity', ['reply_to' => 'id']],
'activity_reply_to_fkey' => ['activity_source', ['source' => 'code']],
'activity_conversation_fkey' => ['conversation', ['conversation' => 'id']],
'activity_repeat_of_fkey' => ['activity', ['repeat_of' => 'id']], // @fixme: what about repeats of deleted activities?
],
'indexes' => [
'notice_created_id_is_local_idx' => ['created', 'id', 'is_local'],
'notice_profile_id_idx' => ['profile_id', 'created', 'id'],
'notice_is_local_created_profile_id_idx' => ['is_local', 'created', 'profile_id'],
'notice_repeat_of_created_id_idx' => ['repeat_of', 'created', 'id'],
'notice_conversation_created_id_idx' => ['conversation', 'created', 'id'],
'notice_object_type_idx' => ['object_type'],
'notice_verb_idx' => ['verb'],
'notice_profile_id_verb_idx' => ['profile_id', 'verb'],
'notice_url_idx' => ['url'],
'notice_replyto_idx' => ['reply_to'],
'activity_created_id_is_local_idx' => ['created', 'id', 'is_local'],
'activity_profile_id_idx' => ['profile_id', 'created', 'id'],
'activity_is_local_created_profile_id_idx' => ['is_local', 'created', 'profile_id'],
'activity_repeat_of_created_id_idx' => ['repeat_of', 'created', 'id'],
'activity_conversation_created_id_idx' => ['conversation', 'created', 'id'],
'activity_object_type_idx' => ['object_type'],
'activity_verb_idx' => ['verb'],
'activity_profile_id_verb_idx' => ['profile_id', 'verb'],
'activity_replyto_idx' => ['reply_to'],
],
];
// TODO
// if (common_config('search', 'type') == 'fulltext') {
// $def['fulltext indexes'] = ['content' => ['content']];
// }
if (common_config('search', 'type') == 'fulltext') {
$def['fulltext indexes'] = ['content' => ['content']];
}
return $def;
}

View File

@ -35,7 +35,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class NoticeLocation
class ActivityLocation
{
// {{{ Autocode
@ -117,22 +117,22 @@ class NoticeLocation
public static function schemaDef(): array
{
return [
'name' => 'notice_location',
'name' => 'activity_location',
'fields' => [
'notice_id' => ['type' => 'int', 'not null' => true, 'description' => 'notice that is the reply'],
'lat' => ['type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'latitude'],
'lon' => ['type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'longitude'],
'location_id' => ['type' => 'int', 'description' => 'location id if possible'],
'location_ns' => ['type' => 'int', 'description' => 'namespace for location'],
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'activity_id' => ['type' => 'int', 'not null' => true, 'description' => 'activity this refers to'],
'lat' => ['type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'latitude'],
'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'],
],
'primary key' => ['notice_id'],
'primary key' => ['activity_id'],
'foreign keys' => [
'notice_location_notice_id_fkey' => ['notice', ['notice_id' => 'id']],
'activity_location_activity_id_fkey' => ['activity', ['activity_id' => 'id']],
],
'indexes' => [
'notice_location_location_id_idx' => ['location_id'],
'activity_location_location_id_idx' => ['location_id'],
],
];
}
}
}

View File

@ -35,7 +35,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class NoticeSource
class ActivitySource
{
// {{{ Autocode
@ -117,16 +117,15 @@ class NoticeSource
public static function schemaDef(): array
{
return [
'name' => 'notice_source',
'name' => 'activity_source',
'fields' => [
'code' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'source code'],
'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'],
'notice_id' => ['type' => 'int', 'not null' => true, 'default' => 0, 'description' => 'date this record was created'],
'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'],
'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'],
],
'primary key' => ['code'],
];
}
}
}

View File

@ -35,7 +35,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class NoticeTag
class ActivityTag
{
// {{{ Autocode
@ -81,22 +81,22 @@ class NoticeTag
public static function schemaDef(): array
{
return [
'name' => 'notice_tag',
'name' => 'activity_tag',
'description' => 'Hash tags',
'fields' => [
'tag' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this notice'],
'notice_id' => ['type' => 'int', 'not null' => true, 'description' => 'notice tagged'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'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'],
],
'primary key' => ['tag', 'notice_id'],
'primary key' => ['tag', 'activity_id'],
'foreign keys' => [
'notice_tag_notice_id_fkey' => ['notice', ['notice_id' => 'id']],
'activity_tag_activity_id_fkey' => ['activity', ['activity_id' => 'id']],
],
'indexes' => [
'notice_tag_created_idx' => ['created'],
'notice_tag_notice_id_idx' => ['notice_id'],
'notice_tag_tag_created_notice_id_idx' => ['tag', 'created', 'notice_id'],
'activity_tag_created_idx' => ['created'],
'activity_tag_activity_id_idx' => ['activity_id'],
'activity_tag_tag_created_activity_id_idx' => ['tag', 'created', 'activity_id'],
],
];
}
}
}

View File

@ -143,19 +143,15 @@ class Avatar
return [
'name' => 'avatar',
'fields' => [
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
'original' => ['type' => 'bool', 'default' => false, 'description' => 'uploaded by user or generated?'],
'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'],
'filename' => ['type' => 'varchar', 'length' => 191, 'description' => 'local filename, if local'],
'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'],
],
'primary key' => ['profile_id', 'width', 'height'],
'unique keys' => [
// 'avatar_filename_key' => array('filename'),
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
'is_original' => ['type' => 'bool', 'default' => false, 'description' => 'uploaded by user or generated?'],
'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'],
],
'primary key' => ['profile_id', 'width', 'height'],
'foreign keys' => [
'avatar_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
],

View File

@ -143,14 +143,14 @@ class ConfirmAddress
return [
'name' => 'confirm_address',
'fields' => [
'code' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'good random code'],
'user_id' => ['type' => 'int', 'default' => 0, 'description' => 'user who requested confirmation'],
'address' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'address (email, xmpp, SMS, etc.)'],
'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")'],
'code' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'good random code'],
'user_id' => ['type' => 'int', 'default' => 0, 'description' => 'user who requested confirmation'],
'address' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'address (email, xmpp, SMS, etc.)'],
'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' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
],
'primary key' => ['code'],
'foreign keys' => [
@ -158,4 +158,4 @@ class ConfirmAddress
],
];
}
}
}

View File

@ -1,120 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for OAuth consumer
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class Consumer
{
// {{{ Autocode
private string $consumer_key;
private string $consumer_secret;
private string $seed;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setConsumerKey(string $consumer_key): self
{
$this->consumer_key = $consumer_key;
return $this;
}
public function getConsumerKey(): string
{
return $this->consumer_key;
}
public function setConsumerSecret(string $consumer_secret): self
{
$this->consumer_secret = $consumer_secret;
return $this;
}
public function getConsumerSecret(): string
{
return $this->consumer_secret;
}
public function setSeed(string $seed): self
{
$this->seed = $seed;
return $this;
}
public function getSeed(): string
{
return $this->seed;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'consumer',
'description' => 'OAuth consumer record',
'fields' => [
'consumer_key' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'unique identifier, root URL'],
'consumer_secret' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'secret value'],
'seed' => ['type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'seed for new tokens by this consumer'],
'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'],
],
'primary key' => ['consumer_key'],
];
}
}

View File

@ -105,11 +105,11 @@ class Conversation
return [
'name' => 'conversation',
'fields' => [
'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)'],
'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' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
],
'primary key' => ['id'],
'unique keys' => [

View File

@ -203,26 +203,26 @@ class File
return [
'name' => 'file',
'fields' => [
'id' => ['type' => 'serial', 'not null' => true],
'urlhash' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'sha256 of destination URL (url field)'],
'url' => ['type' => 'text', 'description' => 'destination URL after following possible redirections'],
'filehash' => ['type' => 'varchar', 'length' => 64, 'not null' => false, 'description' => 'sha256 of the file contents, only for locally stored files of course'],
'mimetype' => ['type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'],
'size' => ['type' => 'int', 'description' => 'size of resource when available'],
'title' => ['type' => 'text', 'description' => 'title of resource when available'],
'date' => ['type' => 'int', 'description' => 'date of resource according to http query'],
'protected' => ['type' => 'int', 'description' => 'true when URL is private (needs login)'],
'filename' => ['type' => 'text', 'description' => 'if file is stored locally (too) this is the filename'],
'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' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'id' => ['type' => 'serial', 'not null' => true],
'url' => ['type' => 'text', 'description' => 'URL after following possible redirections'],
'is_url_protected' => ['type' => 'bool', 'description' => 'true when URL is private (needs login)'],
'url_hash' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'sha256 of destination URL (url field)'],
'file_hash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of the file contents, if the file is stored locally'],
'mimetype' => ['type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'],
'size' => ['type' => 'int', 'description' => 'size of resource when available'],
'title' => ['type' => 'text', 'description' => 'title of resource when available'],
'timestamp' => ['type' => 'int', 'description' => 'unix timestamp according to http query'],
'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'],
],
'primary key' => ['id'],
'unique keys' => [
'file_urlhash_key' => ['urlhash'],
'file_urlhash_key' => ['url_hash'],
],
'indexes' => [
'file_filehash_idx' => ['filehash'],
'file_filehash_idx' => ['file_hash'],
],
];
}

View File

@ -1,135 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for File redirects
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class FileRedirection
{
// {{{ Autocode
private string $urlhash;
private ?string $url;
private ?int $file_id;
private ?int $redirections;
private ?int $httpcode;
private DateTimeInterface $modified;
public function setUrlhash(string $urlhash): self
{
$this->urlhash = $urlhash;
return $this;
}
public function getUrlhash(): string
{
return $this->urlhash;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setFileId(?int $file_id): self
{
$this->file_id = $file_id;
return $this;
}
public function getFileId(): ?int
{
return $this->file_id;
}
public function setRedirections(?int $redirections): self
{
$this->redirections = $redirections;
return $this;
}
public function getRedirections(): ?int
{
return $this->redirections;
}
public function setHttpcode(?int $httpcode): self
{
$this->httpcode = $httpcode;
return $this;
}
public function getHttpcode(): ?int
{
return $this->httpcode;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'file_redirection',
'fields' => [
'urlhash' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'sha256 hash of the URL'],
'url' => ['type' => 'text', 'description' => 'short URL (or any other kind of redirect) for file (id)'],
'file_id' => ['type' => 'int', 'description' => 'short URL for what URL/file'],
'redirections' => ['type' => 'int', 'description' => 'redirect count'],
'httpcode' => ['type' => 'int', 'description' => 'HTTP status code (20x, 30x, etc.)'],
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['urlhash'],
'foreign keys' => [
'file_redirection_file_id_fkey' => ['file', ['file_id' => 'id']],
],
];
}
}

View File

@ -131,22 +131,18 @@ class FileThumbnail
return [
'name' => 'file_thumbnail',
'fields' => [
'file_id' => ['type' => 'int', 'not null' => true, 'description' => 'thumbnail for what URL/file'],
'urlhash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of url field if non-empty'],
'url' => ['type' => 'text', 'description' => 'URL of thumbnail'],
'filename' => ['type' => 'text', 'description' => 'if stored locally, filename is put here'],
'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' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['file_id', 'width', 'height'],
'indexes' => [
'file_thumbnail_file_id_idx' => ['file_id'],
'file_thumbnail_urlhash_idx' => ['urlhash'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
],
'primary key' => ['file_id', 'width', 'height'],
'foreign keys' => [
'file_thumbnail_file_id_fkey' => ['file', ['file_id' => 'id']],
],
'indexes' => [
'file_thumbnail_file_id_idx' => ['file_id'],
],
];
}
}
}

View File

@ -35,7 +35,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class FileToPost
class FileToActivity
{
// {{{ Autocode
@ -81,21 +81,21 @@ class FileToPost
public static function schemaDef(): array
{
return [
'name' => 'file_to_post',
'name' => 'file_to_activity',
'fields' => [
'file_id' => ['type' => 'int', 'not null' => true, 'description' => 'id of URL/file'],
'post_id' => ['type' => 'int', 'not null' => true, 'description' => 'id of the notice it belongs to'],
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'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'],
],
'primary key' => ['file_id', 'post_id'],
'primary key' => ['file_id', 'activity_id'],
'foreign keys' => [
'file_to_post_file_id_fkey' => ['file', ['file_id' => 'id']],
'file_to_post_post_id_fkey' => ['notice', ['post_id' => 'id']],
'file_to_activity_file_id_fkey' => ['file', ['file_id' => 'id']],
'file_to_activity_activity_id_fkey' => ['notice', ['activity_id' => 'id']],
],
'indexes' => [
'file_id_idx' => ['file_id'],
'post_id_idx' => ['post_id'],
'file_id_idx' => ['file_id'],
'activity_id_idx' => ['activity_id'],
],
];
}
}
}

View File

@ -35,7 +35,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class Subscription
class Follow
{
// {{{ Autocode
>>>>>>> e63aa4d971 ([TOOLS] Change autocode tag to allow editor folding)
@ -154,26 +154,21 @@ class Subscription
public static function schemaDef(): array
{
return [
'name' => 'subscription',
'name' => 'follow',
'fields' => [
'subscriber' => ['type' => 'int', 'not null' => true, 'description' => 'profile listening'],
'subscribed' => ['type' => 'int', 'not null' => true, 'description' => 'profile being listened to'],
'jabber' => ['type' => 'bool', 'default' => true, 'description' => 'deliver jabber messages'],
'sms' => ['type' => 'bool', 'default' => true, 'description' => 'deliver sms messages'],
'token' => ['type' => 'varchar', 'length' => 191, 'description' => 'authorization token'],
'secret' => ['type' => 'varchar', 'length' => 191, 'description' => 'token secret'],
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier'],
'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'],
'follower' => ['type' => 'int', 'not null' => true, 'description' => 'profile listening'],
'followed' => ['type' => 'int', 'not null' => true, 'description' => 'profile being listened to'],
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier'],
'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' => ['subscriber', 'subscribed'],
'primary key' => ['follower', 'followed'],
'unique keys' => [
'subscription_uri_key' => ['uri'],
],
'indexes' => [
'subscription_subscriber_idx' => ['subscriber', 'created'],
'subscription_subscribed_idx' => ['subscribed', 'created'],
'subscription_token_idx' => ['token'],
'subscription_subscriber_idx' => ['follower', 'created'],
'subscription_subscribed_idx' => ['followed', 'created'],
],
];
}

View File

@ -35,7 +35,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class SubscriptionQueue
class FollowQueue
{
// {{{ Autocode
@ -81,22 +81,22 @@ class SubscriptionQueue
public static function schemaDef(): array
{
return [
'name' => 'subscription_queue',
'description' => 'Holder for subscription requests awaiting moderation.',
'name' => 'Follow_queue',
'description' => 'Holder for Follow requests awaiting moderation.',
'fields' => [
'subscriber' => ['type' => 'int', 'not null' => true, 'description' => 'remote or local profile making the request'],
'subscribed' => ['type' => 'int', 'not null' => true, 'description' => 'remote or local profile being subscribed to'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
'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'],
],
'primary key' => ['subscriber', 'subscribed'],
'primary key' => ['follower', 'followed'],
'indexes' => [
'subscription_queue_subscriber_created_idx' => ['subscriber', 'created'],
'subscription_queue_subscribed_created_idx' => ['subscribed', 'created'],
'Follow_queue_follower_created_idx' => ['follower', 'created'],
'Follow_queue_followed_created_idx' => ['followed', 'created'],
],
'foreign keys' => [
'subscription_queue_subscriber_fkey' => ['profile', ['subscriber' => 'id']],
'subscription_queue_subscribed_fkey' => ['profile', ['subscribed' => 'id']],
'Follow_queue_follower_fkey' => ['profile', ['follower' => 'id']],
'Follow_queue_followed_fkey' => ['profile', ['followed' => 'id']],
],
];
}
}
}

View File

@ -1,205 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for user's foreign profile
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class ForeignLink
{
// {{{ Autocode
private int $user_id;
private int $foreign_id;
private int $service;
private ?string $credentials;
private int $noticesync;
private int $friendsync;
private int $profilesync;
private ?DateTimeInterface $last_noticesync;
private ?DateTimeInterface $last_friendsync;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setUserId(int $user_id): self
{
$this->user_id = $user_id;
return $this;
}
public function getUserId(): int
{
return $this->user_id;
}
public function setForeignId(int $foreign_id): self
{
$this->foreign_id = $foreign_id;
return $this;
}
public function getForeignId(): int
{
return $this->foreign_id;
}
public function setService(int $service): self
{
$this->service = $service;
return $this;
}
public function getService(): int
{
return $this->service;
}
public function setCredentials(?string $credentials): self
{
$this->credentials = $credentials;
return $this;
}
public function getCredentials(): ?string
{
return $this->credentials;
}
public function setNoticesync(int $noticesync): self
{
$this->noticesync = $noticesync;
return $this;
}
public function getNoticesync(): int
{
return $this->noticesync;
}
public function setFriendsync(int $friendsync): self
{
$this->friendsync = $friendsync;
return $this;
}
public function getFriendsync(): int
{
return $this->friendsync;
}
public function setProfilesync(int $profilesync): self
{
$this->profilesync = $profilesync;
return $this;
}
public function getProfilesync(): int
{
return $this->profilesync;
}
public function setLastNoticesync(?DateTimeInterface $last_noticesync): self
{
$this->last_noticesync = $last_noticesync;
return $this;
}
public function getLastNoticesync(): ?DateTimeInterface
{
return $this->last_noticesync;
}
public function setLastFriendsync(?DateTimeInterface $last_friendsync): self
{
$this->last_friendsync = $last_friendsync;
return $this;
}
public function getLastFriendsync(): ?DateTimeInterface
{
return $this->last_friendsync;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'foreign_link',
'fields' => [
'user_id' => ['type' => 'int', 'not null' => true, 'description' => 'link to user on this system, if exists'],
'foreign_id' => ['type' => 'int', 'size' => 'big', 'unsigned' => true, 'not null' => true, 'description' => 'link to user on foreign service, if exists'],
'service' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to service'],
'credentials' => ['type' => 'varchar', 'length' => 191, 'description' => 'authc credentials, typically a password'],
'noticesync' => ['type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'notice synchronization, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies'],
'friendsync' => ['type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 2, 'description' => 'friend synchronization, bit 1 = sync outgoing, bit 2 = sync incoming'],
'profilesync' => ['type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming'],
'last_noticesync' => ['type' => 'datetime', 'description' => 'last time notices were imported'],
'last_friendsync' => ['type' => 'datetime', 'description' => 'last time friends were imported'],
'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'],
],
'primary key' => ['user_id', 'foreign_id', 'service'],
'foreign keys' => [
'foreign_link_user_id_fkey' => ['user', ['user_id' => 'id']],
'foreign_link_foreign_id_fkey' => ['foreign_user', ['foreign_id' => 'id', 'service' => 'service']],
'foreign_link_service_fkey' => ['foreign_service', ['service' => 'id']],
],
'indexes' => [
'foreign_user_user_id_idx' => ['user_id'],
],
];
}
}

View File

@ -1,122 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for foreign services
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class ForeignService
{
// {{{ Autocode
private int $id;
private string $name;
private ?string $description;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function getId(): int
{
return $this->id;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getName(): string
{
return $this->name;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'foreign_service',
'fields' => [
'id' => ['type' => 'int', 'not null' => true, 'description' => 'numeric key for service'],
'name' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'name of the service'],
'description' => ['type' => 'varchar', 'length' => 191, 'description' => 'description'],
'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'],
],
'primary key' => ['id'],
'unique keys' => [
'foreign_service_name_key' => ['name'],
],
];
}
}

View File

@ -1,116 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for user's foreign subscriptions
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class ForeignSubscription
{
// {{{ Autocode
private int $service;
private int $subscriber;
private int $subscribed;
private DateTimeInterface $created;
public function setService(int $service): self
{
$this->service = $service;
return $this;
}
public function getService(): int
{
return $this->service;
}
public function setSubscriber(int $subscriber): self
{
$this->subscriber = $subscriber;
return $this;
}
public function getSubscriber(): int
{
return $this->subscriber;
}
public function setSubscribed(int $subscribed): self
{
$this->subscribed = $subscribed;
return $this;
}
public function getSubscribed(): int
{
return $this->subscribed;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'foreign_subscription',
'fields' => [
'service' => ['type' => 'int', 'not null' => true, 'description' => 'service where relationship happens'],
'subscriber' => ['type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'subscriber on foreign service'],
'subscribed' => ['type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'subscribed user'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
],
'primary key' => ['service', 'subscriber', 'subscribed'],
'foreign keys' => [
'foreign_subscription_service_fkey' => ['foreign_service', ['service' => 'id']],
'foreign_subscription_subscriber_fkey' => ['foreign_user', ['subscriber' => 'id', 'service' => 'service']],
'foreign_subscription_subscribed_fkey' => ['foreign_user', ['subscribed' => 'id', 'service' => 'service']],
],
'indexes' => [
'foreign_subscription_subscriber_idx' => ['service', 'subscriber'],
'foreign_subscription_subscribed_idx' => ['service', 'subscribed'],
],
];
}
}

View File

@ -1,138 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for Foreign Users
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class ForeignUser
{
// {{{ Autocode
private int $id;
private int $service;
private string $uri;
private ?string $nickname;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function getId(): int
{
return $this->id;
}
public function setService(int $service): self
{
$this->service = $service;
return $this;
}
public function getService(): int
{
return $this->service;
}
public function setUri(string $uri): self
{
$this->uri = $uri;
return $this;
}
public function getUri(): string
{
return $this->uri;
}
public function setNickname(?string $nickname): self
{
$this->nickname = $nickname;
return $this;
}
public function getNickname(): ?string
{
return $this->nickname;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'foreign_user',
'fields' => [
'id' => ['type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'unique numeric key on foreign service'],
'service' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to service'],
'uri' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'identifying URI'],
'nickname' => ['type' => 'varchar', 'length' => 191, 'description' => 'nickname on foreign service'],
'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'],
],
'primary key' => ['id', 'service'],
'foreign keys' => [
'foreign_user_service_fkey' => ['foreign_service', ['service' => 'id']],
],
'unique keys' => [
'foreign_user_uri_key' => ['uri'],
],
];
}
}

View File

@ -35,7 +35,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class UserGroup
class Group
{
// {{{ Autocode
@ -249,42 +249,39 @@ class UserGroup
public static function schemaDef(): array
{
return [
'name' => 'user_group',
'name' => 'group',
'fields' => [
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
'nickname' => ['type' => 'varchar', 'length' => 64, 'description' => 'nickname for addressing'],
'fullname' => ['type' => 'varchar', 'length' => 191, 'description' => 'display name'],
'homepage' => ['type' => 'varchar', 'length' => 191, 'description' => 'URL, cached so we dont regenerate'],
'description' => ['type' => 'text', 'description' => 'group description'],
'location' => ['type' => 'varchar', 'length' => 191, 'description' => 'related physical location, if any'],
'original_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'original size logo'],
'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' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', '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'],
'id' => ['type' => 'serial', 'not null' => true],
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
'nickname' => ['type' => 'varchar', 'length' => 64, 'description' => 'nickname for addressing'],
'fullname' => ['type' => 'varchar', 'length' => 191, 'description' => 'display name'],
'homepage' => ['type' => 'varchar', 'length' => 191, 'description' => 'URL, cached so we dont regenerate'],
'description' => ['type' => 'text', 'description' => 'group description'],
'is_local' => ['type' => 'bool', 'description' => 'whether this group was created in this instance'],
'location' => ['type' => 'varchar', 'length' => 191, 'description' => 'related physical location, if any'],
'original_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'original size logo'],
'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'],
],
'primary key' => ['id'],
'unique keys' => [
'user_group_uri_key' => ['uri'],
// when it's safe and everyone's run upgrade.php 'user_profile_id_key' => array('profile_id'),
'user_group_uri_key' => ['uri'],
'user_profile_id_key' => ['profile_id'],
],
'foreign keys' => [
'user_group_id_fkey' => ['profile', ['profile_id' => 'id']],
],
'indexes' => [
'user_group_nickname_idx' => ['nickname'],
'user_group_profile_id_idx' => ['profile_id'], //make this unique in future
'user_group_profile_id_idx' => ['profile_id'],
],
];
}
}
}

View File

@ -84,16 +84,16 @@ class GroupAlias
'name' => 'group_alias',
'fields' => [
'alias' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'additional nickname for the group'],
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'],
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date alias was created'],
'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'],
],
'primary key' => ['alias'],
'foreign keys' => [
'group_alias_group_id_fkey' => ['user_group', ['group_id' => 'id']],
'group_alias_group_id_fkey' => ['group', ['group_id' => 'id']],
],
'indexes' => [
'group_alias_group_id_idx' => ['group_id'],
],
];
}
}
}

View File

@ -95,17 +95,17 @@ class GroupBlock
return [
'name' => 'group_block',
'fields' => [
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'],
'blocked' => ['type' => 'int', 'not null' => true, 'description' => 'profile that is blocked'],
'blocker' => ['type' => 'int', 'not null' => true, 'description' => 'user making the block'],
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date of blocking'],
'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'],
],
'primary key' => ['group_id', 'blocked'],
'primary key' => ['group_id', 'blocked_profile'],
'foreign keys' => [
'group_block_group_id_fkey' => ['user_group', ['group_id' => 'id']],
'group_block_blocked_fkey' => ['profile', ['blocked' => 'id']],
'group_block_blocker_fkey' => ['user', ['blocker' => 'id']],
'group_block_group_id_fkey' => ['group', ['group_id' => 'id']],
'group_block_blocked_fkey' => ['profile', ['blocked_profile' => 'id']],
'group_block_blocker_fkey' => ['user', ['blocker_user' => 'id']],
],
];
}
}
}

View File

@ -82,22 +82,22 @@ class GroupInbox
{
return [
'name' => 'group_inbox',
'description' => 'Many-many table listing notices posted to a given group, or which groups a given notice was posted to.',
'description' => 'Many-many table listing activities posted to a given group, or which groups a given activity was posted to',
'fields' => [
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'group receiving the message'],
'notice_id' => ['type' => 'int', 'not null' => true, 'description' => 'notice received'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the notice was created'],
'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'],
],
'primary key' => ['group_id', 'notice_id'],
'primary key' => ['group_id', 'activity_id'],
'foreign keys' => [
'group_inbox_group_id_fkey' => ['user_group', ['group_id' => 'id']],
'group_inbox_notice_id_fkey' => ['notice', ['notice_id' => 'id']],
'group_inbox_group_id_fkey' => ['group', ['group_id' => 'id']],
'group_inbox_activity_id_fkey' => ['activity', ['activity_id' => 'id']],
],
'indexes' => [
'group_inbox_created_idx' => ['created'],
'group_inbox_notice_id_idx' => ['notice_id'],
'group_inbox_group_id_created_notice_id_idx' => ['group_id', 'created', 'notice_id'],
'group_inbox_activity_id_idx' => ['activity_id'],
'group_inbox_group_id_created_activity_id_idx' => ['group_id', 'created', 'activity_id'],
'group_inbox_created_idx' => ['created'],
],
];
}
}
}

View File

@ -95,8 +95,8 @@ class GroupJoinQueue
],
'foreign keys' => [
'group_join_queue_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
'group_join_queue_group_id_fkey' => ['user_group', ['group_id' => 'id']],
'group_join_queue_group_id_fkey' => ['group', ['group_id' => 'id']],
],
];
}
}
}

View File

@ -119,23 +119,22 @@ class GroupMember
return [
'name' => 'group_member',
'fields' => [
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to user_group'],
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to group table'],
'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' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'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'],
],
'primary key' => ['group_id', 'profile_id'],
'unique keys' => [
'group_member_uri_key' => ['uri'],
],
'foreign keys' => [
'group_member_group_id_fkey' => ['user_group', ['group_id' => 'id']],
'group_member_group_id_fkey' => ['group', ['group_id' => 'id']],
'group_member_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
],
'indexes' => [
// @fixme probably we want a (profile_id, created) index here?
'group_member_profile_id_idx' => ['profile_id'],
'group_member_created_idx' => ['created'],
'group_member_profile_id_created_idx' => ['profile_id', 'created'],
@ -143,4 +142,4 @@ class GroupMember
],
];
}
}
}

View File

@ -117,7 +117,7 @@ class Invitation
public static function schemaDef(): array
{
return [
'name' => 'invitation',
'name' => 'invitation',
'fields' => [
'code' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'random code for an invitation'],
'user_id' => ['type' => 'int', 'not null' => true, 'description' => 'who sent the invitation'],

View File

@ -1,113 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/soci
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as publ
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public Li
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for local groups
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class LocalGroup
{
// {{{ Autocode
private int $group_id;
private ?string $nickname;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setGroupId(int $group_id): self
{
$this->group_id = $group_id;
return $this;
}
public function getGroupId(): int
{
return $this->group_id;
}
public function setNickname(?string $nickname): self
{
$this->nickname = $nickname;
return $this;
}
public function getNickname(): ?string
{
return $this->nickname;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'local_group',
'description' => 'Record for a user group on the local site, with some additional info not in user_group',
'fields' => [
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'group represented'],
'nickname' => ['type' => 'varchar', 'length' => 64, 'description' => 'group represented'],
'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'],
],
'primary key' => ['group_id'],
'foreign keys' => [
'local_group_group_id_fkey' => ['user_group', ['group_id' => 'id']],
],
'unique keys' => [
'local_group_nickname_key' => ['nickname'],
],
];
}
}

View File

@ -35,7 +35,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class LocationNamespace
class LocationService
{
// {{{ Autocode
@ -93,14 +93,14 @@ class LocationNamespace
public static function schemaDef(): array
{
return [
'name' => 'location_namespace',
'name' => 'location_service',
'fields' => [
'id' => ['type' => 'int', 'not null' => true, 'description' => 'identity for this namespace'],
'description' => ['type' => 'varchar', 'length' => 191, 'description' => 'description of the namespace'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the record was created'],
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'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'],
],
'primary key' => ['id'],
];
}
}
}

View File

@ -1,109 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for Login tokens
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class LoginToken
{
// {{{ Autocode
private int $user_id;
private string $token;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setUserId(int $user_id): self
{
$this->user_id = $user_id;
return $this;
}
public function getUserId(): int
{
return $this->user_id;
}
public function setToken(string $token): self
{
$this->token = $token;
return $this;
}
public function getToken(): string
{
return $this->token;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'login_token',
'fields' => [
'user_id' => ['type' => 'int', 'not null' => true, 'description' => 'user owning this token'],
'token' => ['type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'token useable for logging in'],
'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'],
],
'primary key' => ['user_id'],
'foreign keys' => [
'login_token_user_id_fkey' => ['user', ['user_id' => 'id']],
],
];
}
}

View File

@ -1,133 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for nonce
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class Nonce
{
// {{{ Autocode
private string $consumer_key;
private ?string $tok;
private string $nonce;
private DateTimeInterface $ts;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setConsumerKey(string $consumer_key): self
{
$this->consumer_key = $consumer_key;
return $this;
}
public function getConsumerKey(): string
{
return $this->consumer_key;
}
public function setTok(?string $tok): self
{
$this->tok = $tok;
return $this;
}
public function getTok(): ?string
{
return $this->tok;
}
public function setNonce(string $nonce): self
{
$this->nonce = $nonce;
return $this;
}
public function getNonce(): string
{
return $this->nonce;
}
public function setTs(DateTimeInterface $ts): self
{
$this->ts = $ts;
return $this;
}
public function getTs(): DateTimeInterface
{
return $this->ts;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'nonce',
'description' => 'OAuth nonce record',
'fields' => [
'consumer_key' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'unique identifier, root URL'],
'tok' => ['type' => 'char', 'length' => 32, 'description' => 'buggy old value, ignored'],
'nonce' => ['type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'nonce'],
'ts' => ['type' => 'datetime', 'not null' => true, 'description' => 'timestamp sent'],
'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'],
],
'primary key' => ['consumer_key', 'ts', 'nonce'],
];
}
}

View File

@ -1,140 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for Notice preferences
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Diogo Cordeiro <diogo@fc.up.pt>
* @license 2018 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class NoticePrefs
{
// {{{ Autocode
private int $notice_id;
private string $namespace;
private string $topic;
private $data;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setNoticeId(int $notice_id): self
{
$this->notice_id = $notice_id;
return $this;
}
public function getNoticeId(): int
{
return $this->notice_id;
}
public function setNamespace(string $namespace): self
{
$this->namespace = $namespace;
return $this;
}
public function getNamespace(): string
{
return $this->namespace;
}
public function setTopic(string $topic): self
{
$this->topic = $topic;
return $this;
}
public function getTopic(): string
{
return $this->topic;
}
public function setData($data): self
{
$this->data = $data;
return $this;
}
public function getData()
{
return $this->data;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'notice_prefs',
'fields' => [
'notice_id' => ['type' => 'int', 'not null' => true, 'description' => 'user'],
'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' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['notice_id', 'namespace', 'topic'],
'foreign keys' => [
'notice_prefs_notice_id_fkey' => ['notice', ['notice_id' => 'id']],
],
'indexes' => [
'notice_prefs_notice_id_idx' => ['notice_id'],
],
];
}
}

View File

@ -35,7 +35,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class Attention
class Notification
{
// {{{ Autocode
@ -105,14 +105,14 @@ class Attention
public static function schemaDef(): array
{
return [
'name' => 'attention',
'description' => 'Notice attentions to profiles (that are not a mention and not result of a subscription)',
'name' => 'notification',
'description' => 'Activity notification for profiles (that are not a mention and not result of a subscription)',
'fields' => [
'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'],
'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' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'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'],
],
'primary key' => ['notice_id', 'profile_id'],
'foreign keys' => [

View File

@ -1,244 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for OAuth Application
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class OauthApplication
{
// {{{ Autocode
private int $id;
private int $owner;
private string $consumer_key;
private string $name;
private ?string $description;
private string $icon;
private ?string $source_url;
private ?string $organization;
private ?string $homepage;
private ?string $callback_url;
private ?int $type;
private ?int $access_type;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function getId(): int
{
return $this->id;
}
public function setOwner(int $owner): self
{
$this->owner = $owner;
return $this;
}
public function getOwner(): int
{
return $this->owner;
}
public function setConsumerKey(string $consumer_key): self
{
$this->consumer_key = $consumer_key;
return $this;
}
public function getConsumerKey(): string
{
return $this->consumer_key;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getName(): string
{
return $this->name;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setIcon(string $icon): self
{
$this->icon = $icon;
return $this;
}
public function getIcon(): string
{
return $this->icon;
}
public function setSourceUrl(?string $source_url): self
{
$this->source_url = $source_url;
return $this;
}
public function getSourceUrl(): ?string
{
return $this->source_url;
}
public function setOrganization(?string $organization): self
{
$this->organization = $organization;
return $this;
}
public function getOrganization(): ?string
{
return $this->organization;
}
public function setHomepage(?string $homepage): self
{
$this->homepage = $homepage;
return $this;
}
public function getHomepage(): ?string
{
return $this->homepage;
}
public function setCallbackUrl(?string $callback_url): self
{
$this->callback_url = $callback_url;
return $this;
}
public function getCallbackUrl(): ?string
{
return $this->callback_url;
}
public function setType(?int $type): self
{
$this->type = $type;
return $this;
}
public function getType(): ?int
{
return $this->type;
}
public function setAccessType(?int $access_type): self
{
$this->access_type = $access_type;
return $this;
}
public function getAccessType(): ?int
{
return $this->access_type;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'oauth_application',
'description' => 'OAuth application registration record',
'fields' => [
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
'owner' => ['type' => 'int', 'not null' => true, 'description' => 'owner of the application'],
'consumer_key' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'application consumer key'],
'name' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'name of the application'],
'description' => ['type' => 'varchar', 'length' => 191, 'description' => 'description of the application'],
'icon' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'default' => '/theme/base/default-avatar-stream.png', 'description' => 'application icon'],
'source_url' => ['type' => 'varchar', 'length' => 191, 'description' => 'application homepage - used for source link'],
'organization' => ['type' => 'varchar', 'length' => 191, 'description' => 'name of the organization running the application'],
'homepage' => ['type' => 'varchar', 'length' => 191, 'description' => 'homepage for the organization'],
'callback_url' => ['type' => 'varchar', 'length' => 191, 'description' => 'url to redirect to after authentication'],
'type' => ['type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'type of app, 1 = browser, 2 = desktop'],
'access_type' => ['type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'default access type, bit 1 = read, bit 2 = write'],
'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'],
],
'primary key' => ['id'],
'unique keys' => [
'oauth_application_name_key' => ['name'], // in the long run, we should perhaps not force these unique, and use another source id
],
'foreign keys' => [
'oauth_application_owner_fkey' => ['profile', ['owner' => 'id']], // Are remote users allowed to create oauth application records?
'oauth_application_consumer_key_fkey' => ['consumer', ['consumer_key' => 'consumer_key']],
],
];
}
}

View File

@ -1,136 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for OAuth Application User
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class OauthApplicationUser
{
// {{{ Autocode
private int $profile_id;
private int $application_id;
private ?int $access_type;
private ?string $token;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setProfileId(int $profile_id): self
{
$this->profile_id = $profile_id;
return $this;
}
public function getProfileId(): int
{
return $this->profile_id;
}
public function setApplicationId(int $application_id): self
{
$this->application_id = $application_id;
return $this;
}
public function getApplicationId(): int
{
return $this->application_id;
}
public function setAccessType(?int $access_type): self
{
$this->access_type = $access_type;
return $this;
}
public function getAccessType(): ?int
{
return $this->access_type;
}
public function setToken(?string $token): self
{
$this->token = $token;
return $this;
}
public function getToken(): ?string
{
return $this->token;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'oauth_application_user',
'fields' => [
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'user of the application'],
'application_id' => ['type' => 'int', 'not null' => true, 'description' => 'id of the application'],
'access_type' => ['type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'access type, bit 1 = read, bit 2 = write'],
'token' => ['type' => 'varchar', 'length' => 191, 'description' => 'request or access token'],
'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'],
],
'primary key' => ['profile_id', 'application_id'],
'foreign keys' => [
'oauth_application_user_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
'oauth_application_user_application_id_fkey' => ['oauth_application', ['application_id' => 'id']],
],
];
}
}

View File

@ -1,124 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for association between OAuth and internal token
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class OauthTokenAssociation
{
// {{{ Autocode
private int $profile_id;
private int $application_id;
private string $token;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setProfileId(int $profile_id): self
{
$this->profile_id = $profile_id;
return $this;
}
public function getProfileId(): int
{
return $this->profile_id;
}
public function setApplicationId(int $application_id): self
{
$this->application_id = $application_id;
return $this;
}
public function getApplicationId(): int
{
return $this->application_id;
}
public function setToken(string $token): self
{
$this->token = $token;
return $this;
}
public function getToken(): string
{
return $this->token;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'oauth_token_association',
'description' => 'Associate an application ID and profile ID with an OAuth token',
'fields' => [
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'associated user'],
'application_id' => ['type' => 'int', 'not null' => true, 'description' => 'the application'],
'token' => ['type' => 'varchar', 'length' => '191', 'not null' => true, 'description' => 'token used for this association'],
'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'],
],
'primary key' => ['profile_id', 'application_id', 'token'],
'foreign keys' => [
'oauth_token_association_profile_fkey' => ['profile', ['profile_id' => 'id']],
'oauth_token_association_application_fkey' => ['oauth_application', ['application_id' => 'id']],
],
];
}
}

View File

@ -1,141 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for Separate table for storing UI preferences
*
* @category DB
* @package GNUsocial
*
* @deprecated
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class OldSchoolPrefs
{
// {{{ Autocode
private int $user_id;
private ?bool $stream_mode_only;
private ?bool $conversation_tree;
private ?bool $stream_nicknames;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setUserId(int $user_id): self
{
$this->user_id = $user_id;
return $this;
}
public function getUserId(): int
{
return $this->user_id;
}
public function setStreamModeOnly(?bool $stream_mode_only): self
{
$this->stream_mode_only = $stream_mode_only;
return $this;
}
public function getStreamModeOnly(): ?bool
{
return $this->stream_mode_only;
}
public function setConversationTree(?bool $conversation_tree): self
{
$this->conversation_tree = $conversation_tree;
return $this;
}
public function getConversationTree(): ?bool
{
return $this->conversation_tree;
}
public function setStreamNicknames(?bool $stream_nicknames): self
{
$this->stream_nicknames = $stream_nicknames;
return $this;
}
public function getStreamNicknames(): ?bool
{
return $this->stream_nicknames;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'old_school_prefs',
'fields' => [
'user_id' => ['type' => 'int', 'not null' => true, 'description' => 'user who has the preference'],
'stream_mode_only' => ['type' => 'bool',
'default' => true,
'description' => 'No conversation streams', ],
'conversation_tree' => ['type' => 'bool',
'default' => true,
'description' => 'Hierarchical tree view for conversations', ],
'stream_nicknames' => ['type' => 'bool',
'default' => true,
'description' => 'Show nicknames for authors and addressees in streams', ],
'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'],
],
'primary key' => ['user_id'],
'foreign keys' => [
'old_school_prefs_user_id_fkey' => ['user', ['user_id' => 'id']],
],
];
}
}

View File

@ -204,19 +204,18 @@ class Profile
'name' => 'profile',
'description' => 'local and remote users have profiles',
'fields' => [
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
'nickname' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'nickname or username', 'collate' => 'utf8mb4_general_ci'],
'fullname' => ['type' => 'text', 'description' => 'display name', 'collate' => 'utf8mb4_general_ci'],
'profileurl' => ['type' => 'text', 'description' => 'URL, cached so we dont regenerate'],
'homepage' => ['type' => 'text', 'description' => 'identifying URL', 'collate' => 'utf8mb4_general_ci'],
'bio' => ['type' => 'text', 'description' => 'descriptive biography', 'collate' => 'utf8mb4_general_ci'],
'location' => ['type' => 'text', 'description' => 'physical location', 'collate' => 'utf8mb4_general_ci'],
'lat' => ['type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'latitude'],
'lon' => ['type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'longitude'],
'location_id' => ['type' => 'int', 'description' => 'location id if possible'],
'location_ns' => ['type' => 'int', 'description' => 'namespace for location'],
'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'],
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
'nickname' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'nickname or username'],
'fullname' => ['type' => 'text', 'description' => 'display name'],
'homepage' => ['type' => 'text', 'description' => 'identifying URL'],
'bio' => ['type' => 'text', 'description' => 'descriptive biography'],
'location' => ['type' => 'text', 'description' => 'physical location'],
'lat' => ['type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'latitude'],
'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'],
],
'primary key' => ['id'],
'indexes' => [
@ -224,10 +223,9 @@ class Profile
],
];
// TODO
// if (common_config('search', 'type') == 'fulltext') {
// $def['fulltext indexes'] = ['nickname' => ['nickname', 'fullname', 'location', 'bio', 'homepage']];
// }
if (common_config('search', 'type') == 'fulltext') {
$def['fulltext indexes'] = ['nickname' => ['nickname', 'fullname', 'location', 'bio', 'homepage']];
}
return $def;
}

View File

@ -85,13 +85,13 @@ 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' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date of blocking'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date of blocking'],
],
'primary key' => ['blocker', 'blocked'],
'foreign keys' => [
'profile_block_blocker_fkey' => ['user', ['blocker' => 'id']],
'profile_block_blocked_fkey' => ['profile', ['blocked' => 'id']],
],
'primary key' => ['blocker', 'blocked'],
];
}
}
}

View File

@ -177,19 +177,20 @@ class ProfileList
public static function schemaDef(): array
{
return [
'name' => 'profile_list',
'fields' => [
'id' => ['type' => 'int', 'not null' => true, 'description' => 'unique identifier'],
'tagger' => ['type' => 'int', 'not null' => true, 'description' => 'user making the tag'],
'tag' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'people tag'],
'description' => ['type' => 'text', 'description' => 'description of the people tag'],
'private' => ['type' => 'bool', 'default' => false, 'description' => 'is this tag private'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the tag was added'],
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date the tag was modified'],
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'],
'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'],
'subscriber_count' => ['type' => 'int', 'default' => 0, 'description' => 'number of subscribers to this tag'],
'name' => 'profile_list',
'description' => 'a profile can have lists of profiles, to separate their timeline',
'fields' => [
'id' => ['type' => 'int', 'not null' => true, 'description' => 'unique identifier'],
'tagger' => ['type' => 'int', 'not null' => true, 'description' => 'user making the tag'],
'tag' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'people tag'],
'description' => ['type' => 'text', 'description' => 'description of the people tag'],
'private' => ['type' => 'bool', 'default' => false, 'description' => 'is this tag private'],
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'],
'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'],
],
'primary key' => ['tagger', 'tag'],
'unique keys' => [
@ -199,11 +200,11 @@ class ProfileList
'profile_list_tagger_fkey' => ['profile', ['tagger' => 'id']],
],
'indexes' => [
'profile_list_modified_idx' => ['modified'],
'profile_list_tag_idx' => ['tag'],
'profile_list_tagger_tag_idx' => ['tagger', 'tag'],
'profile_list_tagged_count_idx' => ['tagged_count'],
'profile_list_subscriber_count_idx' => ['subscriber_count'],
'profile_list_modified_idx' => ['modified'],
'profile_list_tag_idx' => ['tag'],
'profile_list_tagger_tag_idx' => ['tagger', 'tag'],
'profile_list_tagged_count_idx' => ['tagged_count'],
'profile_list_follower_count_idx' => ['follower_count'],
],
];
}

View File

@ -124,7 +124,7 @@ class ProfilePrefs
'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' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
],
'primary key' => ['profile_id', 'namespace', 'topic'],
'foreign keys' => [
@ -135,4 +135,4 @@ class ProfilePrefs
],
];
}
}
}

View File

@ -85,7 +85,7 @@ class ProfileRole
'fields' => [
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'account having the role'],
'role' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'string representing the role'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the role was granted'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
],
'primary key' => ['profile_id', 'role'],
'foreign keys' => [
@ -94,4 +94,4 @@ class ProfileRole
'indexes' => ['profile_role_role_created_profile_id_idx' => ['role', 'created', 'profile_id']],
];
}
}
}

View File

@ -93,8 +93,7 @@ class ProfileTag
public static function schemaDef(): array
{
return [
'name' => 'profile_tag',
'name' => 'profile_tag',
'fields' => [
'tagger' => ['type' => 'int', 'not null' => true, 'description' => 'user making the tag'],
'tagged' => ['type' => 'int', 'not null' => true, 'description' => 'profile tagged'],
@ -113,4 +112,4 @@ class ProfileTag
],
];
}
}
}

View File

@ -35,7 +35,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class ProfileTagSubscription
class ProfileTagFollow
{
// {{{ Autocode
@ -93,24 +93,23 @@ class ProfileTagSubscription
public static function schemaDef(): array
{
return [
'name' => 'profile_tag_subscription',
'name' => 'profile_tag_follow',
'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' => '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'],
],
'primary key' => ['profile_tag_id', 'profile_id'],
'foreign keys' => [
'profile_tag_subscription_profile_list_id_fkey' => ['profile_list', ['profile_tag_id' => 'id']],
'profile_tag_subscription_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
'profile_tag_follow_profile_list_id_fkey' => ['profile_list', ['profile_tag_id' => 'id']],
'profile_tag_follow_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
],
'indexes' => [
// @fixme probably we want a (profile_id, created) index here?
'profile_tag_subscription_profile_id_idx' => ['profile_id'],
'profile_tag_subscription_created_idx' => ['created'],
'profile_tag_follow_profile_id_idx' => ['profile_id'],
'profile_tag_follow_created_idx' => ['created'],
],
];
}
}
}

View File

@ -110,7 +110,7 @@ class QueueItem
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
'frame' => ['type' => 'blob', 'not null' => true, 'description' => 'data: object reference or opaque string'],
'transport' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'queue for what? "email", "xmpp", "sms", "irc", ...'],
'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'],
'claimed' => ['type' => 'datetime', 'description' => 'date this item was claimed'],
],
'primary key' => ['id'],
@ -119,4 +119,4 @@ class QueueItem
],
];
}
}
}

View File

@ -90,9 +90,9 @@ class RelatedGroup
],
'primary key' => ['group_id', 'related_group_id'],
'foreign keys' => [
'related_group_group_id_fkey' => ['user_group', ['group_id' => 'id']],
'related_group_related_group_id_fkey' => ['user_group', ['related_group_id' => 'id']],
'related_group_group_id_fkey' => ['group', ['group_id' => 'id']],
'related_group_related_group_id_fkey' => ['group', ['related_group_id' => 'id']],
],
];
}
}
}

View File

@ -1,96 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for user remember me
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class RememberMe
{
// {{{ Autocode
private string $code;
private int $user_id;
private DateTimeInterface $modified;
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getCode(): string
{
return $this->code;
}
public function setUserId(int $user_id): self
{
$this->user_id = $user_id;
return $this;
}
public function getUserId(): int
{
return $this->user_id;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'remember_me',
'fields' => [
'code' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'good random code'],
'user_id' => ['type' => 'int', 'not null' => true, 'description' => 'user who is logged in'],
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['code'],
'foreign keys' => [
'remember_me_user_id_fkey' => ['user', ['user_id' => 'id']],
],
];
}
}

View File

@ -1,116 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for Notice reply
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class Reply
{
// {{{ Autocode
private int $notice_id;
private int $profile_id;
private DateTimeInterface $modified;
private ?int $replied_id;
public function setNoticeId(int $notice_id): self
{
$this->notice_id = $notice_id;
return $this;
}
public function getNoticeId(): int
{
return $this->notice_id;
}
public function setProfileId(int $profile_id): self
{
$this->profile_id = $profile_id;
return $this;
}
public function getProfileId(): int
{
return $this->profile_id;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
public function setRepliedId(?int $replied_id): self
{
$this->replied_id = $replied_id;
return $this;
}
public function getRepliedId(): ?int
{
return $this->replied_id;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'reply',
'fields' => [
'notice_id' => ['type' => 'int', 'not null' => true, 'description' => 'notice that is the reply'],
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'profile replied to'],
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'replied_id' => ['type' => 'int', 'description' => 'notice replied to (not used, see notice.reply_to)'],
],
'primary key' => ['notice_id', 'profile_id'],
'foreign keys' => [
'reply_notice_id_fkey' => ['notice', ['notice_id' => 'id']],
'reply_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
],
'indexes' => [
'reply_notice_id_idx' => ['notice_id'],
'reply_profile_id_idx' => ['profile_id'],
'reply_replied_id_idx' => ['replied_id'],
'reply_profile_id_modified_notice_id_idx' => ['profile_id', 'modified', 'notice_id'],
],
];
}
}

View File

@ -35,7 +35,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class UnavailableStatusNetwork
class ReservedNickname
{
// {{{ Autocode
@ -69,16 +69,13 @@ class UnavailableStatusNetwork
public static function schemaDef(): array
{
return [
'name' => 'unavailable_status_network',
'description' => 'An unavailable status network nickname',
'name' => 'reserved_nickname',
'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', ],
'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'],
],
'primary key' => ['nickname'],
];
}
}
}

View File

@ -1,94 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for the Schema Version
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class SchemaVersion
{
// {{{ Autocode
private string $table_name;
private string $checksum;
private DateTimeInterface $modified;
public function setTableName(string $table_name): self
{
$this->table_name = $table_name;
return $this;
}
public function getTableName(): string
{
return $this->table_name;
}
public function setChecksum(string $checksum): self
{
$this->checksum = $checksum;
return $this;
}
public function getChecksum(): string
{
return $this->checksum;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'schema_version',
'description' => 'To avoid checking database structure all the time, we store a checksum of the expected schema info for each table here. If it has not changed since the last time we checked the table, we can leave it as is.',
'fields' => [
'table_name' => ['type' => 'varchar', 'length' => '64', 'not null' => true, 'description' => 'Table name'],
'checksum' => ['type' => 'varchar', 'length' => '64', 'not null' => true, 'description' => 'Checksum of schema array; a mismatch indicates we should check the table more thoroughly.'],
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['table_name'],
];
}
}

View File

@ -1,111 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for Superclass representing a saved session as it exists in the database.
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Diogo Cordeiro <diogo@fc.up.pt>
* @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class Session
{
// {{{ Autocode
private string $id;
private ?string $session_data;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setId(string $id): self
{
$this->id = $id;
return $this;
}
public function getId(): string
{
return $this->id;
}
public function setSessionData(?string $session_data): self
{
$this->session_data = $session_data;
return $this;
}
public function getSessionData(): ?string
{
return $this->session_data;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'session',
'fields' => [
'id' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'session ID'],
'session_data' => ['type' => 'text', 'description' => 'session data'],
'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'],
],
'primary key' => ['id'],
'indexes' => [
'session_modified_idx' => ['modified'],
],
];
}
}

View File

@ -111,7 +111,7 @@ class SmsCarrier
'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' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
],
'primary key' => ['id'],
'unique keys' => [
@ -119,4 +119,4 @@ class SmsCarrier
],
];
}
}
}

View File

@ -1,175 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for User token
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class Token
{
// {{{ Autocode
private string $consumer_key;
private string $tok;
private string $secret;
private int $type;
private ?int $state;
private ?string $verifier;
private ?string $verified_callback;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setConsumerKey(string $consumer_key): self
{
$this->consumer_key = $consumer_key;
return $this;
}
public function getConsumerKey(): string
{
return $this->consumer_key;
}
public function setTok(string $tok): self
{
$this->tok = $tok;
return $this;
}
public function getTok(): string
{
return $this->tok;
}
public function setSecret(string $secret): self
{
$this->secret = $secret;
return $this;
}
public function getSecret(): string
{
return $this->secret;
}
public function setType(int $type): self
{
$this->type = $type;
return $this;
}
public function getType(): int
{
return $this->type;
}
public function setState(?int $state): self
{
$this->state = $state;
return $this;
}
public function getState(): ?int
{
return $this->state;
}
public function setVerifier(?string $verifier): self
{
$this->verifier = $verifier;
return $this;
}
public function getVerifier(): ?string
{
return $this->verifier;
}
public function setVerifiedCallback(?string $verified_callback): self
{
$this->verified_callback = $verified_callback;
return $this;
}
public function getVerifiedCallback(): ?string
{
return $this->verified_callback;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'token',
'description' => 'OAuth token record',
'fields' => [
'consumer_key' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'unique identifier, root URL'],
'tok' => ['type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'identifying value'],
'secret' => ['type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'secret value'],
'type' => ['type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'request or access'],
'state' => ['type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'for requests, 0 = initial, 1 = authorized, 2 = used'],
'verifier' => ['type' => 'varchar', 'length' => 191, 'description' => 'verifier string for OAuth 1.0a'],
'verified_callback' => ['type' => 'varchar', 'length' => 191, 'description' => 'verified callback URL for OAuth 1.0a'],
'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'],
],
'primary key' => ['consumer_key', 'tok'],
'foreign keys' => [
'token_consumer_key_fkey' => ['consumer', ['consumer_key' => 'consumer_key']],
],
];
}
}

View File

@ -348,47 +348,38 @@ class User
'name' => 'user',
'description' => 'local users',
'fields' => [
'id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
'nickname' => ['type' => 'varchar', 'length' => 64, 'description' => 'nickname or username, duped in profile'],
'password' => ['type' => 'varchar', 'length' => 191, 'description' => 'salted password, can be null for OpenID users'],
'email' => ['type' => 'varchar', 'length' => 191, 'description' => 'email address for password recovery etc.'],
'incomingemail' => ['type' => 'varchar', 'length' => 191, 'description' => 'email address for post-by-email'],
'emailnotifysub' => ['type' => 'bool', 'default' => true, 'description' => 'Notify by email of subscriptions'],
'emailnotifyfav' => ['type' => 'int', 'size' => 'tiny', 'default' => null, 'description' => 'Notify by email of favorites'],
'emailnotifynudge' => ['type' => 'bool', 'default' => true, 'description' => 'Notify by email of nudges'],
'emailnotifymsg' => ['type' => 'bool', 'default' => true, 'description' => 'Notify by email of direct messages'],
'emailnotifyattn' => ['type' => 'bool', 'default' => true, 'description' => 'Notify by email of @-replies'],
'language' => ['type' => 'varchar', 'length' => 50, 'description' => 'preferred language'],
'timezone' => ['type' => 'varchar', 'length' => 50, 'description' => 'timezone'],
'emailpost' => ['type' => 'bool', 'default' => true, 'description' => 'Post by email'],
'sms' => ['type' => 'varchar', 'length' => 64, 'description' => 'sms phone number'],
'carrier' => ['type' => 'int', 'description' => 'foreign key to sms_carrier'],
'smsnotify' => ['type' => 'bool', 'default' => false, 'description' => 'whether to send notices to SMS'],
'smsreplies' => ['type' => 'bool', 'default' => false, 'description' => 'whether to send notices to SMS on replies'],
'smsemail' => ['type' => 'varchar', 'length' => 191, 'description' => 'built from sms and carrier'],
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier, usually a tag URI'],
'autosubscribe' => ['type' => 'bool', 'default' => false, 'description' => 'automatically subscribe to users who subscribe to us'],
'subscribe_policy' => ['type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => '0 = anybody can subscribe; 1 = require approval'],
'urlshorteningservice' => ['type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'],
'private_stream' => ['type' => 'bool', 'default' => false, 'description' => 'whether to limit all notices to followers only'],
'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'],
'id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
'nickname' => ['type' => 'varchar', 'length' => 64, 'description' => 'nickname or username, duped in profile'],
'password' => ['type' => 'varchar', 'length' => 191, 'description' => 'salted password, can be null for OpenID users'],
'outgoing_email' => ['type' => 'varchar', 'length' => 191, 'description' => 'email address for password recovery, notifications, etc.'],
'incoming_email' => ['type' => 'varchar', 'length' => 191, 'description' => 'email address for post-by-email'],
'language' => ['type' => 'varchar', 'length' => 50, 'description' => 'preferred language'],
'timezone' => ['type' => 'varchar', 'length' => 50, 'description' => 'timezone'],
'sms_phone_number' => ['type' => 'varchar', 'length' => 64, 'description' => 'sms phone number'],
'sms_carrier' => ['type' => 'int', 'description' => 'foreign key to sms_carrier'],
'sms_email' => ['type' => 'varchar', 'length' => 191, 'description' => 'built from sms and carrier (see sms_carrier)'],
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier, usually a tag URI'],
'auto_follow_back' => ['type' => 'bool', 'default' => false, 'description' => 'automatically follow users who follow us'],
'follow_policy' => ['type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => '0 = anybody can follow; 1 = require approval'],
'is_stream_private' => ['type' => 'bool', 'default' => false, 'description' => 'whether to limit all notices to followers only'],
'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' => [
'user_nickname_key' => ['nickname'],
'user_email_key' => ['email'],
'user_incomingemail_key' => ['incomingemail'],
'user_sms_key' => ['sms'],
'user_uri_key' => ['uri'],
'user_nickname_key' => ['nickname'],
'user_outgoing_email_key' => ['outgoing_email'],
'user_incoming_email_key' => ['incoming_email'],
'user_sms_key' => ['sms_phone_number'],
'user_uri_key' => ['uri'],
],
'foreign keys' => [
'user_id_fkey' => ['profile', ['id' => 'id']],
'user_carrier_fkey' => ['sms_carrier', ['carrier' => 'id']],
'user_carrier_fkey' => ['sms_carrier', ['sms_carrier' => 'id']],
],
'indexes' => [
'user_created_idx' => ['created'],
'user_smsemail_idx' => ['smsemail'],
'user_created_idx' => ['created'],
'user_sms_email_idx' => ['sms_email'],
],
];
}

View File

@ -96,7 +96,7 @@ class UserLocationPrefs
'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' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
],
'primary key' => ['user_id'],
'foreign keys' => [
@ -104,4 +104,4 @@ class UserLocationPrefs
],
];
}
}
}

View File

@ -33,7 +33,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class UserImPrefs
class UserNotificationPrefs
{
// {{{ Autocode
@ -139,24 +139,34 @@ class UserImPrefs
public static function schemaDef(): array
{
return [
'name' => 'user_im_prefs',
'name' => 'user_notification_prefs',
'fields' => [
'user_id' => ['type' => 'int', 'not null' => true, 'description' => 'user'],
'screenname' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'screenname on this service'],
'transport' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'transport (ex xmpp, aim)'],
'notify' => ['type' => 'bool', 'not null' => true, 'default' => false, 'description' => 'Notify when a new notice is sent'],
'replies' => ['type' => 'bool', 'not null' => true, 'default' => false, 'description' => 'Send replies from people not subscribed to'],
'updatefrompresence' => ['type' => 'bool', 'not null' => true, 'default' => false, 'description' => 'Update from presence.'],
'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'],
'user_id' => ['type' => 'int', 'not null' => true],
'service_name' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'name on this service'],
'transport' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'transport (ex xmpp, aim)'],
'profile_id' => ['type' => 'int', 'default' => null, 'description' => 'If not null, settings are specific only to a given profiles'],
'posts_by_followed' => ['type' => 'bool', 'not null' => true, 'default' => false, 'description' => 'Notify when a new notice by someone we follow is made'],
'mention' => ['type' => 'bool', 'not null' => true, 'default' => false, 'description' => 'Notify when mentioned by someone we do not follow'],
'follow' => ['type' => 'bool', 'not null' => true, 'default' => false, 'description' => 'Notify someone follows us'],
'favorite' => ['type' => 'bool', 'not null' => true, 'default' => false, 'description' => 'Notify someone favorites a notice by us'],
'nudge' => ['type' => 'bool', 'not null' => true, 'default' => false, 'description' => 'Notify someone nudges us'],
'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'],
],
'primary key' => ['user_id', 'transport'],
'unique keys' => [
'transport_screenname_key' => ['transport', 'screenname'],
'transport_service_key' => ['transport', 'service_name'],
],
'foreign keys' => [
'user_im_prefs_user_id_fkey' => ['user', ['user_id' => 'id']],
'user_notification_prefs_user_id_fkey' => ['user', ['user_id' => 'id']],
'user_notification_prefs_profile' => ['profile', ['profile_id' => 'id']],
],
'indexes' => [
'user_notification_prefs_user_profile_idx' => ['user_id', 'profile_id'],
],
];
}
}
}

View File

@ -35,7 +35,7 @@ use DateTimeInterface;
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class UserUrlshortenerPrefs
class UserUrlShortenerPrefs
{
// {{{ Autocode
@ -117,14 +117,14 @@ class UserUrlshortenerPrefs
public static function schemaDef(): array
{
return [
'name' => 'user_urlshortener_prefs',
'name' => 'user_url_shortener_prefs',
'fields' => [
'user_id' => ['type' => 'int', 'not null' => true, 'description' => 'user'],
'urlshorteningservice' => ['type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'],
'maxurllength' => ['type' => 'int', 'not null' => true, 'description' => 'urls greater than this length will be shortened, 0 = always, null = never'],
'maxnoticelength' => ['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' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
'user_id' => ['type' => 'int', 'not null' => true, 'description' => 'user'],
'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'],
],
'primary key' => ['user_id'],
'foreign keys' => [
@ -132,4 +132,4 @@ class UserUrlshortenerPrefs
],
];
}
}
}

View File

@ -1,125 +0,0 @@
<?php
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace App\Entity;
use DateTimeInterface;
/**
* Entity for association between user and username
*
* @category DB
* @package GNUsocial
*
* @author Zach Copley <zach@status.net>
* @copyright 2010 StatusNet Inc.
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class UserUsername
{
// {{{ Autocode
private string $provider_name;
private string $username;
private int $user_id;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function setProviderName(string $provider_name): self
{
$this->provider_name = $provider_name;
return $this;
}
public function getProviderName(): string
{
return $this->provider_name;
}
public function setUsername(string $username): self
{
$this->username = $username;
return $this;
}
public function getUsername(): string
{
return $this->username;
}
public function setUserId(int $user_id): self
{
$this->user_id = $user_id;
return $this;
}
public function getUserId(): int
{
return $this->user_id;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// }}} Autocode
public static function schemaDef(): array
{
return [
'name' => 'user_username',
'fields' => [
'provider_name' => ['type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'provider name'],
'username' => ['type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'username'],
'user_id' => ['type' => 'int', 'not null' => true, 'description' => 'notice id this title relates to'],
'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'],
],
'primary key' => ['provider_name', 'username'],
'indexes' => [
'user_id_idx' => ['user_id'],
],
'foreign keys' => [
'user_username_user_id_fkey' => ['user', ['user_id' => 'id']],
],
];
}
}