Commit 9ca3c3d1 authored by Evan Prodromou's avatar Evan Prodromou

move core schema to class files

parent 8eac5d26
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Avatar extends Memcached_DataObject
class Avatar extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -32,6 +32,32 @@ class Avatar extends Memcached_DataObject
return Memcached_DataObject::pivotGet('Avatar', $keyCol, $keyVals, $otherCols);
}
public static function schemaDef()
{
return array(
'fields' => array(
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'),
'original' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'uploaded by user or generated?'),
'width' => array('type' => 'int', 'not null' => true, 'description' => 'image width'),
'height' => array('type' => 'int', 'not null' => true, 'description' => 'image height'),
'mediatype' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'file type'),
'filename' => array('type' => 'varchar', 'length' => 255, 'description' => 'local filename, if local'),
'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'avatar location'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('profile_id', 'width', 'height'),
'unique keys' => array(
'avatar_url_key' => array('url'),
),
'foreign keys' => array(
'avatar_profile_id_fkey' => array('profile', array('profile_id' => 'id')),
),
'indexes' => array(
'avatar_profile_id_idx' => array('profile_id'),
),
);
}
// We clean up the file, too
function delete()
......
......@@ -27,7 +27,7 @@ if (!defined('STATUSNET')) {
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Config extends Memcached_DataObject
class Config extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -43,6 +43,18 @@ class Config extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'section' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'default' => '', 'description' => 'configuration section'),
'setting' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'default' => '', 'description' => 'configuration setting'),
'value' => array('type' => 'varchar', 'length' => 255, 'description' => 'configuration value'),
),
'primary key' => array('section', 'setting'),
);
}
const settingsKey = 'config:settings';
static function loadSettings()
......
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Confirm_address extends Memcached_DataObject
class Confirm_address extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -29,6 +29,26 @@ class Confirm_address extends Memcached_DataObject
function sequenceKey()
{ return array(false, false); }
public static function schemaDef()
{
return array(
'fields' => array(
'code' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'good random code'),
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who requested confirmation'),
'address' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'address (email, xmpp, SMS, etc.)'),
'address_extra' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'carrier ID, for SMS'),
'address_type' => array('type' => 'varchar', 'length' => 8, 'not null' => true, 'description' => 'address type ("email", "xmpp", "sms")'),
'claimed' => array('type' => 'datetime', 'description' => 'date this was claimed for queueing'),
'sent' => array('type' => 'datetime', 'description' => 'date this was sent for queueing'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('code'),
'foreign keys' => array(
'confirm_address_user_id_fkey' => array('user', array('user_id' => 'id')),
),
);
}
static function getAddress($address, $addressType)
{
$ca = new Confirm_address();
......
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Consumer extends Memcached_DataObject
class Consumer extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -23,6 +23,22 @@ class Consumer extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'description' => 'OAuth consumer record',
'fields' => array(
'consumer_key' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'unique identifier, root URL'),
'consumer_secret' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'secret value'),
'seed' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'seed for new tokens by this consumer'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('consumer_key'),
);
}
static function generateNew()
{
$cons = new Consumer();
......
......@@ -29,7 +29,7 @@
require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
class Conversation extends Memcached_DataObject
class Conversation extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -46,6 +46,22 @@ class Conversation extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'),
'uri' => array('type' => 'varchar', 'length' => 225, 'description' => 'URI of the conversation'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('id'),
'unique keys' => array(
'conversation_uri_key' => array('uri'),
),
);
}
/**
* Factory method for creating a new conversation
*
......
......@@ -26,7 +26,7 @@ if (!defined('STATUSNET')) {
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Deleted_notice extends Memcached_DataObject
class Deleted_notice extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -43,4 +43,24 @@ class Deleted_notice extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'id' => array('type' => 'int', 'not null' => true, 'description' => 'identity of notice'),
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'author of the notice'),
'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universally unique identifier, usually a tag URI'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the notice record was created'),
'deleted' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the notice record was created'),
),
'primary key' => array('id'),
'unique keys' => array(
'deleted_notice_uri_key' => array('uri'),
),
'indexes' => array(
'deleted_notice_profile_id_idx' => array('profile_id'),
),
);
}
}
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Fave extends Memcached_DataObject
class Fave extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -21,6 +21,27 @@ class Fave extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice that is the favorite'),
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who likes this notice'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('notice_id', 'user_id'),
'foreign keys' => array(
'fave_notice_id_fkey' => array('notice', array('notice_id' => 'id')),
'fave_user_id_fkey' => array('profile', array('user_id' => 'id')), // note: formerly referenced notice.id, but we can now record remote users' favorites
),
'indexes' => array(
'fave_notice_id_idx' => array('notice_id'),
'fave_user_id_idx' => array('user_id', 'modified'),
'fave_modified_idx' => array('modified'),
),
);
}
/**
* Save a favorite record.
* @fixme post-author notification should be moved here
......
......@@ -29,7 +29,7 @@ require_once INSTALLDIR.'/classes/File_to_post.php';
/**
* Table Definition for file
*/
class File extends Memcached_DataObject
class File extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -51,6 +51,28 @@ class File extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'id' => array('type' => 'serial', 'not null' => true),
'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'destination URL after following redirections'),
'mimetype' => array('type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'),
'size' => array('type' => 'int', 'description' => 'size of resource when available'),
'title' => array('type' => 'varchar', 'length' => 255, 'description' => 'title of resource when available'),
'date' => array('type' => 'int', 'description' => 'date of resource according to http query'),
'protected' => array('type' => 'int', 'description' => 'true when URL is private (needs login)'),
'filename' => array('type' => 'varchar', 'length' => 255, 'description' => 'if a local file, name of the file'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('id'),
'unique keys' => array(
'file_url_key' => array('url'),
),
);
}
function isProtected($url) {
return 'http://www.facebook.com/login.php' === $url;
}
......
......@@ -26,7 +26,7 @@ require_once INSTALLDIR.'/classes/File_redirection.php';
* Table Definition for file_oembed
*/
class File_oembed extends Memcached_DataObject
class File_oembed extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -53,6 +53,32 @@ class File_oembed extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'file_id' => array('type' => 'int', 'not null' => true, 'description' => 'oEmbed for that URL/file'),
'version' => array('type' => 'varchar', 'length' => 20, 'description' => 'oEmbed spec. version'),
'type' => array('type' => 'varchar', 'length' => 20, 'description' => 'oEmbed type: photo, video, link, rich'),
'mimetype' => array('type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'),
'provider' => array('type' => 'varchar', 'length' => 50, 'description' => 'name of this oEmbed provider'),
'provider_url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL of this oEmbed provider'),
'width' => array('type' => 'int', 'description' => 'width of oEmbed resource when available'),
'height' => array('type' => 'int', 'description' => 'height of oEmbed resource when available'),
'html' => array('type' => 'text', 'description' => 'html representation of this oEmbed resource when applicable'),
'title' => array('type' => 'varchar', 'length' => 255, 'description' => 'title of oEmbed resource when available'),
'author_name' => array('type' => 'varchar', 'length' => 50, 'description' => 'author name for this oEmbed resource'),
'author_url' => array('type' => 'varchar', 'length' => 255, 'description' => 'author URL for this oEmbed resource'),
'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL for this oEmbed resource when applicable (photo, link)'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('file_id'),
'foreign keys' => array(
'file_oembed_file_id_fkey' => array('file', array('file_id' => 'id')),
),
);
}
function sequenceKey()
{
return array(false, false, false);
......
......@@ -27,7 +27,7 @@ require_once INSTALLDIR.'/classes/File_oembed.php';
* Table Definition for file_redirection
*/
class File_redirection extends Memcached_DataObject
class File_redirection extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -45,6 +45,23 @@ class File_redirection extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'url' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'short URL (or any other kind of redirect) for file (id)'),
'file_id' => array('type' => 'int', 'description' => 'short URL for what URL/file'),
'redirections' => array('type' => 'int', 'description' => 'redirect count'),
'httpcode' => array('type' => 'int', 'description' => 'HTTP status code (20x, 30x, etc.)'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('url'),
'foreign keys' => array(
'file_redirection_file_id_fkey' => array('file' => array('file_id' => 'id')),
),
);
}
static function _commonHttp($url, $redirs) {
$request = new HTTPClient($url);
$request->setConfig(array(
......
......@@ -25,7 +25,7 @@ require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
* Table Definition for file_thumbnail
*/
class File_thumbnail extends Memcached_DataObject
class File_thumbnail extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -43,6 +43,26 @@ class File_thumbnail extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'file_id' => array('type' => 'int', 'not null' => true, 'description' => 'thumbnail for what URL/file'),
'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL of thumbnail'),
'width' => array('type' => 'int', 'description' => 'width of thumbnail'),
'height' => array('type' => 'int', 'description' => 'height of thumbnail'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('file_id'),
'foreign keys' => array(
'file_thumbnail_file_id_fkey' => array('file', array('file_id' => 'id')),
),
'unique keys' => array(
'file_thumbnail_url_key' => array('url'),
),
);
}
function sequenceKey()
{
return array(false, false, false);
......
......@@ -25,7 +25,7 @@ require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
* Table Definition for file_to_post
*/
class File_to_post extends Memcached_DataObject
class File_to_post extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -41,6 +41,25 @@ class File_to_post extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'file_id' => array('type' => 'int', 'not null' => true, 'description' => 'id of URL/file'),
'post_id' => array('type' => 'int', 'not null' => true, 'description' => 'id of the notice it belongs to'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('file_id', 'post_id'),
'foreign keys' => array(
'file_to_post_file_id_fkey' => array('file', array('file_id' => 'id')),
'file_to_post_post_id_fkey' => array('notice', array('post_id' => 'id')),
),
'indexes' => array(
'post_id_idx' => array('post_id'),
),
);
}
function processNew($file_id, $notice_id) {
static $seen = array();
if (empty($seen[$notice_id]) || !in_array($file_id, $seen[$notice_id])) {
......
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Foreign_link extends Memcached_DataObject
class Foreign_link extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -29,6 +29,34 @@ class Foreign_link extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'link to user on this system, if exists'),
'foreign_id' => array('type' => 'int', 'size' => 'big', 'unsigned' => true, 'not null' => true, 'description' => 'link to user on foreign service, if exists'),
'service' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to service'),
'credentials' => array('type' => 'varchar', 'length' => 255, 'description' => 'authc credentials, typically a password'),
'noticesync' => array('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' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 2, 'description' => 'friend synchronization, bit 1 = sync outgoing, bit 2 = sync incoming'),
'profilesync' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming'),
'last_noticesync' => array('type' => 'datetime', 'description' => 'last time notices were imported'),
'last_friendsync' => array('type' => 'datetime', 'description' => 'last time friends were imported'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('user_id', 'foreign_id', 'service'),
'foreign keys' => array(
'foreign_link_user_id_fkey' => array('user', array('user_id' => 'id')),
'foreign_link_foreign_id_fkey' => array('foreign_user', array('foreign_id' => 'id', 'service' => 'service')),
'foreign_link_service_fkey' => array('foreign_service', array('service' => 'id')),
),
'indexes' => array(
'foreign_user_user_id_idx' => array('user_id'),
),
);
}
static function getByUserID($user_id, $service)
{
if (empty($user_id) || empty($service)) {
......
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Foreign_service extends Memcached_DataObject
class Foreign_service extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -22,4 +22,21 @@ class Foreign_service extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'id' => array('type' => 'int', 'not null' => true, 'description' => 'numeric key for service'),
'name' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'name of the service'),
'description' => array('type' => 'varchar', 'length' => 255, 'description' => 'description'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('id'),
'unique keys' => array(
'foreign_service_name_key' => array('name'),
),
);
}
}
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Foreign_subscription extends Memcached_DataObject
class Foreign_subscription extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -21,4 +21,27 @@ class Foreign_subscription extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'service' => array('type' => 'int', 'not null' => true, 'description' => 'service where relationship happens'),
'subscriber' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'subscriber on foreign service'),
'subscribed' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'subscribed user'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
),
'primary key' => array('service', 'subscriber', 'subscribed'),
'foreign keys' => array(
'foreign_subscription_service_fkey' => array('foreign_service', array('service' => 'id')),
'foreign_subscription_subscriber_fkey' => array('foreign_user', array('subscriber' => 'id', 'service' => 'service')),
'foreign_subscription_subscribed_fkey' => array('foreign_user', array('subscribed' => 'id', 'service' => 'service')),
),
'indexes' => array(
'foreign_subscription_subscriber_idx' => array('service', 'subscriber'),
'foreign_subscription_subscribed_idx' => array('service', 'subscribed'),
),
);
}
}
......@@ -4,7 +4,7 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Foreign_user extends Memcached_DataObject
class Foreign_user extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -23,6 +23,27 @@ class Foreign_user extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'id' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'unique numeric key on foreign service'),
'service' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to service'),
'uri' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'identifying URI'),
'nickname' => array('type' => 'varchar', 'length' => 255, 'description' => 'nickname on foreign service'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
),
'primary key' => array('id', 'service'),
'foreign keys' => array(
'foreign_user_service_fkey' => array('foreign_service', array('service' => 'id')),
),
'unique keys' => array(
'foreign_user_uri_key' => array('uri'),
),
);
}
// XXX: This only returns a 1->1 single obj mapping. Change? Or make
// a getForeignUsers() that returns more than one? --Zach
static function getForeignUser($id, $service) {
......
......@@ -23,7 +23,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Group_alias extends Memcached_DataObject
class Group_alias extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -38,4 +38,22 @@ class Group_alias extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'alias' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'additional nickname for the group'),
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date alias was created'),
),
'primary key' => array('alias'),
'foreign keys' => array(
'group_alias_group_id_fkey' => array('user_group', array('group_id' => 'id')),
),
'indexes' => array(
'group_alias_group_id_idx' => array('group_id'),
),
);
}
}
......@@ -23,7 +23,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Group_block extends Memcached_DataObject
class Group_block extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -40,6 +40,24 @@ class Group_block extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'fields' => array(
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'),
'blocked' => array('type' => 'int', 'not null' => true, 'description' => 'profile that is blocked'),
'blocker' => array('type' => 'int', 'not null' => true, 'description' => 'user making the block'),
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date of blocking'),
),
'primary key' => array('group_id', 'blocked'),
'foreign keys' => array(
'group_block_group_id_fkey' => array('user_group', array('group_id' => 'id')),
'group_block_blocked_fkey' => array('profile', array('blocked' => 'id')),
'group_block_blocker_fkey' => array('user', array('blocker' => 'id')),
),
);
}
function pkeyGet($kv)
{
return Memcached_DataObject::pkeyGet('Group_block', $kv);
......
......@@ -3,7 +3,7 @@
/**
* Table Definition for group_inbox
*/
class Group_inbox extends Memcached_DataObject
class Group_inbox extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......@@ -20,6 +20,27 @@ class Group_inbox extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(
'description' => 'Many-many table listing notices posted to a given group, or which groups a given notice was posted to.',
'fields' => array(
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group receiving the message'),
'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice received'),
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the notice was created'),
),
'primary key' => array('group_id', 'notice_id'),
'foreign keys' => array(
'group_inbox_group_id_fkey' => array('user_group', array('group_id' => 'id')),
'group_inbox_notice_id_fkey' => array('notice', array('notice_id' => 'id')),
),
'indexes' => array(
'group_inbox_created_idx' => array('created'),
'group_inbox_notice_id_idx' => array('notice_id'),
),
);
}
function pkeyGet($kv)
{
return Memcached_DataObject::pkeyGet('Group_inbox', $kv);
......
......@@ -3,7 +3,7 @@
* Table Definition for group_member
*/
class Group_member extends Memcached_DataObject
class Group_member extends Managed_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
......
......@@ -29,7 +29,7 @@
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Inbox extends Memcached_DataObject
class Inbox extends Managed_DataObject
{
const BOXCAR = 128;
const MAX_NOTICES = 1024;
......@@ -47,6 +47,20 @@ class Inbox extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public static function schemaDef()
{
return array(