Make user_group able to handle remote groups

We add a local_group table to store data about local groups. It has
the unique key for nickname, so /group/<nickname> looks up here.

Updated DB data object classes and data files.
This commit is contained in:
Evan Prodromou 2010-02-24 23:28:41 -05:00
parent 374c488cf1
commit bd68154772
4 changed files with 72 additions and 50 deletions

23
classes/Local_group.php Executable file
View File

@ -0,0 +1,23 @@
<?php
/**
* Table Definition for local_group
*/
require_once 'classes/Memcached_DataObject.php';
class Local_group extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
public $__table = 'local_group'; // table name
public $group_id; // int(4) primary_key not_null
public $nickname; // varchar(64) unique_key
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
/* Static get */
function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Local_group',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
}

View File

@ -10,21 +10,22 @@ class User_group extends Memcached_DataObject
public $__table = 'user_group'; // table name public $__table = 'user_group'; // table name
public $id; // int(4) primary_key not_null public $id; // int(4) primary_key not_null
public $nickname; // varchar(64) unique_key public $nickname; // varchar(64)
public $fullname; // varchar(255) public $fullname; // varchar(255)
public $homepage; // varchar(255) public $homepage; // varchar(255)
public $description; // text() public $description; // text
public $location; // varchar(255) public $location; // varchar(255)
public $original_logo; // varchar(255) public $original_logo; // varchar(255)
public $homepage_logo; // varchar(255) public $homepage_logo; // varchar(255)
public $stream_logo; // varchar(255) public $stream_logo; // varchar(255)
public $mini_logo; // varchar(255) public $mini_logo; // varchar(255)
public $design_id; // int(4) public $design_id; // int(4)
public $created; // datetime() not_null public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
public $uri; // varchar(255) unique_key
/* Static get */ /* Static get */
function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User_group',$k,$v); } function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('User_group',$k,$v); }
/* the code above is auto generated do not remove the tag below */ /* the code above is auto generated do not remove the tag below */
###END_AUTOCODE ###END_AUTOCODE

58
classes/statusnet.ini Normal file → Executable file
View File

@ -1,3 +1,4 @@
[avatar] [avatar]
profile_id = 129 profile_id = 129
original = 17 original = 17
@ -55,7 +56,6 @@ modified = 384
[conversation__keys] [conversation__keys]
id = N id = N
uri = U
[deleted_notice] [deleted_notice]
id = 129 id = 129
@ -103,7 +103,6 @@ modified = 384
[file__keys] [file__keys]
id = N id = N
url = U
[file_oembed] [file_oembed]
file_id = 129 file_id = 129
@ -245,13 +244,6 @@ modified = 384
group_id = K group_id = K
profile_id = K profile_id = K
[invitation]
code = 130
user_id = 129
address = 130
address_type = 130
created = 142
[inbox] [inbox]
user_id = 129 user_id = 129
notice_ids = 66 notice_ids = 66
@ -259,9 +251,26 @@ notice_ids = 66
[inbox__keys] [inbox__keys]
user_id = K user_id = K
[invitation]
code = 130
user_id = 129
address = 130
address_type = 130
created = 142
[invitation__keys] [invitation__keys]
code = K code = K
[local_group]
group_id = 129
nickname = 2
created = 142
modified = 384
[local_group__keys]
group_id = K
nickname = U
[location_namespace] [location_namespace]
id = 129 id = 129
description = 2 description = 2
@ -369,7 +378,7 @@ icon = 130
source_url = 2 source_url = 2
organization = 2 organization = 2
homepage = 2 homepage = 2
callback_url = 130 callback_url = 2
type = 17 type = 17
access_type = 17 access_type = 17
created = 142 created = 142
@ -377,7 +386,6 @@ modified = 384
[oauth_application__keys] [oauth_application__keys]
id = N id = N
name = U
[oauth_application_user] [oauth_application_user]
profile_id = 129 profile_id = 129
@ -440,13 +448,13 @@ tag = K
[queue_item] [queue_item]
id = 129 id = 129
frame = 66 frame = 194
transport = 130 transport = 130
created = 142 created = 142
claimed = 14 claimed = 14
[queue_item__keys] [queue_item__keys]
id = K id = N
[related_group] [related_group]
group_id = 129 group_id = 129
@ -593,31 +601,10 @@ mini_logo = 2
design_id = 1 design_id = 1
created = 142 created = 142
modified = 384 modified = 384
uri = 2
[user_group__keys] [user_group__keys]
id = N id = N
nickname = U
[user_openid]
canonical = 130
display = 130
user_id = 129
created = 142
modified = 384
[user_openid__keys]
canonical = K
display = U
[user_openid_trustroot]
trustroot = 130
user_id = 129
created = 142
modified = 384
[user_openid__keys]
trustroot = K
user_id = K
[user_location_prefs] [user_location_prefs]
user_id = 129 user_id = 129
@ -627,4 +614,3 @@ modified = 384
[user_location_prefs__keys] [user_location_prefs__keys]
user_id = K user_id = K

View File

@ -406,7 +406,7 @@ create table profile_block (
create table user_group ( create table user_group (
id integer auto_increment primary key comment 'unique identifier', id integer auto_increment primary key comment 'unique identifier',
nickname varchar(64) unique key comment 'nickname for addressing', nickname varchar(64) comment 'nickname for addressing',
fullname varchar(255) comment 'display name', fullname varchar(255) comment 'display name',
homepage varchar(255) comment 'URL, cached so we dont regenerate', homepage varchar(255) comment 'URL, cached so we dont regenerate',
description text comment 'group description', description text comment 'group description',
@ -421,6 +421,8 @@ create table user_group (
created datetime not null comment 'date this record was created', created datetime not null comment 'date this record was created',
modified timestamp comment 'date this record was modified', modified timestamp comment 'date this record was modified',
uri varchar(255) unique key comment 'universal identifier',
index user_group_nickname_idx (nickname) index user_group_nickname_idx (nickname)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
@ -641,3 +643,13 @@ create table conversation (
modified timestamp comment 'date this record was modified' modified timestamp comment 'date this record was modified'
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
create table local_group (
group_id integer primary key comment 'group represented' references user_group (id),
nickname varchar(64) unique key comment 'group represented',
created datetime not null comment 'date this record was created',
modified timestamp comment 'date this record was modified'
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;