Merge branch '0.8.x' of git@gitorious.org:laconica/dev into 0.8.x

* '0.8.x' of git@gitorious.org:laconica/dev:
  script to upgrade a database from 0.7.4 to 0.8.0
  change foreign_user.id to bigint (for Twitter, Facebook, etc.)
  use printf instead of echo for startdaemons.sh
This commit is contained in:
Zach Copley 2009-06-24 16:11:48 -07:00
commit 5067f2ba3a
4 changed files with 123 additions and 15 deletions

View File

@ -4,42 +4,41 @@
*/
require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
class Foreign_user extends Memcached_DataObject
class Foreign_user extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
public $__table = 'foreign_user'; // table name
public $id; // int(4) primary_key not_null
public $id; // bigint(8) primary_key not_null
public $service; // int(4) primary_key not_null
public $uri; // varchar(255) unique_key not_null
public $nickname; // varchar(255)
public $nickname; // varchar(255)
public $created; // datetime() not_null
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
function staticGet($k,$v=null)
{ return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
// 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) {
static function getForeignUser($id, $service) {
$fuser = new Foreign_user();
$fuser->whereAdd("service = $service");
$fuser->whereAdd("id = $id");
$fuser->limit(1);
if ($fuser->find()) {
$fuser->fetch();
return $fuser;
}
return null;
return null;
}
function updateKeys(&$orig)
{
$parts = array();
@ -68,5 +67,4 @@ class Foreign_user extends Memcached_DataObject
return $result;
}
}

109
db/074to080.sql Normal file
View File

@ -0,0 +1,109 @@
alter table user
add column design_id integer comment 'id of a design' references design(id),
add column viewdesigns tinyint default 1 comment 'whether to view user-provided designs';
alter table notice add column
conversation integer comment 'id of root notice in this conversation' references notice (id),
add index notice_conversation_idx (conversation);
alter table foreign_user
modify column id bigint not null comment 'unique numeric key on foreign service';
alter table foreign_link
modify column foreign_id bigint unsigned comment 'link to user on foreign service, if exists';
alter table user_group
add column design_id integer comment 'id of a design' references design(id);
create table file (
id integer primary key auto_increment,
url varchar(255) comment 'destination URL after following redirections',
mimetype varchar(50) comment 'mime type of resource',
size integer comment 'size of resource when available',
title varchar(255) comment 'title of resource when available',
date integer(11) comment 'date of resource according to http query',
protected integer(1) comment 'true when URL is private (needs login)',
filename varchar(255) comment 'if a local file, name of the file',
modified timestamp comment 'date this record was modified',
unique(url)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
create table file_oembed (
file_id integer primary key comment 'oEmbed for that URL/file' references file (id),
version varchar(20) comment 'oEmbed spec. version',
type varchar(20) comment 'oEmbed type: photo, video, link, rich',
provider varchar(50) comment 'name of this oEmbed provider',
provider_url varchar(255) comment 'URL of this oEmbed provider',
width integer comment 'width of oEmbed resource when available',
height integer comment 'height of oEmbed resource when available',
html text comment 'html representation of this oEmbed resource when applicable',
title varchar(255) comment 'title of oEmbed resource when available',
author_name varchar(50) comment 'author name for this oEmbed resource',
author_url varchar(255) comment 'author URL for this oEmbed resource',
url varchar(255) comment 'URL for this oEmbed resource when applicable (photo, link)',
modified timestamp comment 'date this record was modified'
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
create table file_redirection (
url varchar(255) primary key comment 'short URL (or any other kind of redirect) for file (id)',
file_id integer comment 'short URL for what URL/file' references file (id),
redirections integer comment 'redirect count',
httpcode integer comment 'HTTP status code (20x, 30x, etc.)',
modified timestamp comment 'date this record was modified'
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
create table file_thumbnail (
file_id integer primary key comment 'thumbnail for what URL/file' references file (id),
url varchar(255) comment 'URL of thumbnail',
width integer comment 'width of thumbnail',
height integer comment 'height of thumbnail',
modified timestamp comment 'date this record was modified',
unique(url)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
create table file_to_post (
file_id integer comment 'id of URL/file' references file (id),
post_id integer comment 'id of the notice it belongs to' references notice (id),
modified timestamp comment 'date this record was modified',
constraint primary key (file_id, post_id)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
create table design (
id integer primary key auto_increment comment 'design ID',
backgroundcolor integer comment 'main background color',
contentcolor integer comment 'content area background color',
sidebarcolor integer comment 'sidebar background color',
textcolor integer comment 'text color',
linkcolor integer comment 'link color',
backgroundimage varchar(255) comment 'background image, if any',
disposition tinyint default 1 comment 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image'
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
create table group_block (
group_id integer not null comment 'group profile is blocked from' references user_group (id),
blocked integer not null comment 'profile that is blocked' references profile (id),
blocker integer not null comment 'user making the block' references user (id),
modified timestamp comment 'date of blocking',
constraint primary key (group_id, blocked)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
create table group_alias (
alias varchar(64) primary key comment 'additional nickname for the group',
group_id integer not null comment 'group profile is blocked from' references user_group (id),
modified timestamp comment 'date alias was created',
index group_alias_group_id_idx (group_id)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;

View File

@ -277,7 +277,7 @@ create table foreign_service (
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
create table foreign_user (
id int not null comment 'unique numeric key on foreign service',
id bigint not null comment 'unique numeric key on foreign service',
service int not null comment 'foreign key to service' references foreign_service(id),
uri varchar(255) not null unique key comment 'identifying URI',
nickname varchar(255) comment 'nickname on foreign service',

View File

@ -35,7 +35,8 @@ DAEMONS=`php $DIR/getvaliddaemons.php $ARGS`
for f in $DAEMONS; do
echo -n "Starting $f...";
printf "Starting $f...";
php $DIR/$f $ARGS
echo "DONE."
printf "DONE.\n"
done