From f429c1aaa0d8fc69567d698bf033cf25f089d6c9 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 25 May 2010 16:25:35 +1200 Subject: the sent column wasn't being populated, needed default --- db/08to09_pg.sql | 1 + db/statusnet_pg.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'db') diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql index b7a0eb8e8..1c9a31699 100644 --- a/db/08to09_pg.sql +++ b/db/08to09_pg.sql @@ -100,4 +100,5 @@ insert into queue_item_new (frame,transport,created,claimed) alter table queue_item rename to queue_item_old; alter table queue_item_new rename to queue_item; +ALTER TABLE confirm_address ALTER column sent set default CURRENT_TIMESTAMP; diff --git a/db/statusnet_pg.sql b/db/statusnet_pg.sql index 3f62ab752..2db98550c 100644 --- a/db/statusnet_pg.sql +++ b/db/statusnet_pg.sql @@ -276,7 +276,7 @@ create table confirm_address ( address_extra varchar(255) not null default '' /* comment 'carrier ID, for SMS' */, address_type varchar(8) not null /* comment 'address type ("email", "jabber", "sms")' */, claimed timestamp /* comment 'date this was claimed for queueing' */, - sent timestamp /* comment 'date this was sent for queueing' */, + sent timestamp default CURRENT_TIMESTAMP /* comment 'date this was sent for queueing' */, modified timestamp /* comment 'date this record was modified' */ ); -- cgit v1.2.3-54-g00ecf From 11398190f0614ec73ecdfefc9d29cbe3f7703323 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 27 May 2010 03:00:58 +0000 Subject: added user_location_prefs to upgrade script --- db/08to09_pg.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'db') diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql index 1c9a31699..de228c117 100644 --- a/db/08to09_pg.sql +++ b/db/08to09_pg.sql @@ -102,3 +102,13 @@ alter table queue_item_new rename to queue_item; ALTER TABLE confirm_address ALTER column sent set default CURRENT_TIMESTAMP; +create table user_location_prefs ( + user_id integer not null /*comment 'user who has the preference'*/ references "user" (id), + share_location int default 1 /* comment 'Whether to share location data'*/, + created timestamp not null /*comment 'date this record was created'*/, + modified timestamp /* comment 'date this record was modified'*/, + + primary key (user_id) +); + + -- cgit v1.2.3-54-g00ecf From cc25ec175530a691686087db4c23a1a28ffd1b62 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 27 May 2010 03:06:42 +0000 Subject: added the inbox table to postgres upgrade script --- db/08to09_pg.sql | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'db') diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql index de228c117..498a94e68 100644 --- a/db/08to09_pg.sql +++ b/db/08to09_pg.sql @@ -111,4 +111,12 @@ create table user_location_prefs ( primary key (user_id) ); +create table inbox ( + + user_id integer not null /* comment 'user receiving the notice' */ references "user" (id), + notice_ids bytea /* comment 'packed list of notice ids' */, + + primary key (user_id) + +); -- cgit v1.2.3-54-g00ecf From 83b976f7eafb74e2ef675262b427be43039428b9 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Mon, 31 May 2010 15:48:24 -0700 Subject: Added DarterosStatus to notice sources --- db/notice_source.sql | 1 + 1 file changed, 1 insertion(+) (limited to 'db') diff --git a/db/notice_source.sql b/db/notice_source.sql index fbcdd6568..5d8664631 100644 --- a/db/notice_source.sql +++ b/db/notice_source.sql @@ -9,6 +9,7 @@ VALUES ('bti','bti','http://gregkh.github.com/bti/', now()), ('choqok', 'Choqok', 'http://choqok.gnufolks.org/', now()), ('cliqset', 'Cliqset', 'http://www.cliqset.com/', now()), + ('DarterosStatus', 'Darteros Status', 'http://www.darteros.com/doc/Darteros_Status', now()), ('deskbar','Deskbar-Applet','http://www.gnome.org/projects/deskbar-applet/', now()), ('Do','Gnome Do','http://do.davebsd.com/wiki/index.php?title=Microblog_Plugin', now()), ('drupal','Drupal','http://drupal.org/', now()), -- cgit v1.2.3-54-g00ecf From 02c68ff5230e505dcfbb1dbd764415db8b8379ee Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 4 Jun 2010 13:16:47 -0700 Subject: Add gNewBook to notice sources --- db/notice_source.sql | 1 + 1 file changed, 1 insertion(+) (limited to 'db') diff --git a/db/notice_source.sql b/db/notice_source.sql index 5d8664631..f5db37f04 100644 --- a/db/notice_source.sql +++ b/db/notice_source.sql @@ -18,6 +18,7 @@ VALUES ('Facebook','Facebook','http://apps.facebook.com/identica/', now()), ('feed2omb','feed2omb','http://projects.ciarang.com/p/feed2omb/', now()), ('get2gnow', 'get2gnow', 'http://uberchicgeekchick.com/?projects=get2gnow', now()), + ('gNewBook', 'gNewBook', 'http://www.gnewbook.org/', now()), ('gravity', 'Gravity', 'http://mobileways.de/gravity', now()), ('Gwibber','Gwibber','http://launchpad.net/gwibber', now()), ('HelloTxt','HelloTxt','http://hellotxt.com/', now()), -- cgit v1.2.3-54-g00ecf From d87b3f3d2e4b15de14987f431981445c1c9db1be Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Mon, 28 Jun 2010 12:02:08 -0700 Subject: Add notice source for StatusNet Desktop --- db/notice_source.sql | 1 + 1 file changed, 1 insertion(+) (limited to 'db') diff --git a/db/notice_source.sql b/db/notice_source.sql index f5db37f04..6bfd5c5f1 100644 --- a/db/notice_source.sql +++ b/db/notice_source.sql @@ -51,6 +51,7 @@ VALUES ('smob','SMOB','http://smob.sioc-project.org/', now()), ('socialoomphBfD4pMqz31', 'SocialOomph', 'http://www.socialoomph.com/', now()), ('spaz','Spaz','http://funkatron.com/spaz', now()), + ('StatusNet Desktop', 'StatusNet Desktop', 'http://status.net/desktop', now()), ('tarpipe','tarpipe','http://tarpipe.com/', now()), ('tjunar','Tjunar','http://nederflash.nl/boek/titels/tjunar-air', now()), ('tr.im','tr.im','http://tr.im/', now()), -- cgit v1.2.3-54-g00ecf From 7065450f03078fb1ac2105b75f9c7a4e052bca9c Mon Sep 17 00:00:00 2001 From: James Walker Date: Tue, 20 Jul 2010 17:34:58 -0700 Subject: normalizing tags for status_network --- classes/Status_network.php | 52 +++++++++++++++++++++++++++++-- classes/Status_network_tag.php | 69 +++++++++++++++++++++++++++++++++++++++++ classes/status_network.ini | 15 +++++++-- db/site.sql | 16 +++++++--- scripts/settag.php | 12 ++----- scripts/setup_status_network.sh | 6 ++-- 6 files changed, 150 insertions(+), 20 deletions(-) create mode 100644 classes/Status_network_tag.php (limited to 'db') diff --git a/classes/Status_network.php b/classes/Status_network.php index 64016dd79..d1ca454e2 100644 --- a/classes/Status_network.php +++ b/classes/Status_network.php @@ -27,7 +27,8 @@ class Status_network extends Safe_DataObject /* the code below is auto generated do not remove the above tag */ public $__table = 'status_network'; // table name - public $nickname; // varchar(64) primary_key not_null + public $site_id; // int(4) primary_key not_null + public $nickname; // varchar(64) unique_key not_null public $hostname; // varchar(255) unique_key public $pathname; // varchar(255) unique_key public $dbhost; // varchar(255) @@ -39,7 +40,6 @@ class Status_network extends Safe_DataObject public $logo; // varchar(255) public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP - public $tags; // text /* Static get */ function staticGet($k,$v=NULL) { @@ -308,9 +308,55 @@ class Status_network extends Safe_DataObject */ function getTags() { - return array_filter(explode("|", strval($this->tags))); + $result = array(); + + $tags = new Status_network_tag(); + $tags->site_id = $this->site_id; + if ($tags->find()) { + while ($tags->fetch()) { + $result[] = $tags->tag; + } + } + + return $result; } + /** + * Save a given set of tags + * @param array tags + */ + function setTags($tags) + { + $this->clearTags(); + foreach ($tags as $tag) { + $snt = new Status_network_tag(); + $snt->site_id = $this->site_id; + $snt->tag = $tag; + $snt->created = common_sql_now(); + + $id = $snt->insert(); + if (!$id) { + throw new Exception(_("Unable to save tag.")); + } + } + + return true; + } + + function clearTags() + { + $tag = new Status_network_tag(); + $tag->site_id = $this->site_id; + + if ($tag->find()) { + while($tag->fetch()) { + $tag->delete(); + } + } + + $tag->free(); + } + /** * Check if this site record has a particular meta-info tag attached. * @param string $tag diff --git a/classes/Status_network_tag.php b/classes/Status_network_tag.php new file mode 100644 index 000000000..18c508bc8 --- /dev/null +++ b/classes/Status_network_tag.php @@ -0,0 +1,69 @@ +. + */ + +if (!defined('STATUSNET')) { exit(1); } + +class Status_network_tag extends Safe_DataObject +{ + ###START_AUTOCODE + /* the code below is auto generated do not remove the above tag */ + + public $__table = 'status_network_tag'; // table name + public $site_id; // int(4) primary_key not_null + public $tag; // varchar(64) primary_key not_null + public $created; // datetime() not_null + + + function __construct() + { + global $config; + global $_DB_DATAOBJECT; + + $sn = new Status_network(); + $sn->_connect(); + + $config['db']['table_'. $this->__table] = $sn->_database; + + $this->_connect(); + } + + + /* Static get */ + function staticGet($k,$v=null) + { + $i = DB_DataObject::staticGet('Status_network_tag',$k,$v); + + // Don't use local process cache; if we're fetching multiple + // times it's because we're reloading it in a long-running + // process; we need a fresh copy! + global $_DB_DATAOBJECT; + unset($_DB_DATAOBJECT['CACHE']['status_network_tag']); + return $i; + } + + /* the code above is auto generated do not remove the tag below */ + ###END_AUTOCODE + + + + function pkeyGet($kv) + { + return Memcached_DataObject::pkeyGet('Status_network_tag', $kv); + } +} diff --git a/classes/status_network.ini b/classes/status_network.ini index adb71cba7..83226e915 100644 --- a/classes/status_network.ini +++ b/classes/status_network.ini @@ -1,4 +1,5 @@ [status_network] +side_id = 129 nickname = 130 hostname = 2 pathname = 2 @@ -11,9 +12,19 @@ theme = 2 logo = 2 created = 142 modified = 384 -tags = 34 [status_network__keys] -nickname = K +site_id = K +nickname = U hostname = U pathname = U + +[status_network_tag] +site_id = 129 +tag = 130 +created = 142 + +[status_network_tag__keys] +site_id = K +tag = K + diff --git a/db/site.sql b/db/site.sql index 791303bd5..bc425841d 100644 --- a/db/site.sql +++ b/db/site.sql @@ -1,8 +1,9 @@ /* For managing multiple sites */ create table status_network ( - - nickname varchar(64) primary key comment 'nickname', + + site_id integer auto_increment primary key comment 'unique id', + nickname varchar(64) unique key comment 'nickname', hostname varchar(255) unique key comment 'alternate hostname if any', pathname varchar(255) unique key comment 'alternate pathname if any', @@ -15,9 +16,16 @@ create table status_network ( theme varchar(255) comment 'theme name', logo varchar(255) comment 'site logo', - tags text comment 'site meta-info tags (pipe-separated)', - 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_general_ci; + +create table status_network_tag ( + site_id integer comment 'unique id', + tag varchar(64) comment 'tag name', + created datetime not null comment 'date the record was created', + + constraint primary key (site_id, tag) +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; + diff --git a/scripts/settag.php b/scripts/settag.php index d1b06ff10..ca260f7bf 100644 --- a/scripts/settag.php +++ b/scripts/settag.php @@ -39,11 +39,10 @@ if (count($args) < 1) { } $nickname = $args[0]; - $sn = Status_network::memGet('nickname', $nickname); if (empty($sn)) { - print "No such site.\n"; + print "No such site ($nickname).\n"; exit(-1); } @@ -54,16 +53,13 @@ if (count($args) == 1) { exit(0); } $tag = $args[1]; - $i = array_search($tag, $tags); if ($i !== false) { if (have_option('d', 'delete')) { // Delete unset($tags[$i]); - $orig = clone($sn); - $sn->tags = implode('|', $tags); - $result = $sn->update($orig); + $result = $sn->setTags($tags); if (!$result) { print "Couldn't update.\n"; exit(-1); @@ -78,9 +74,7 @@ if ($i !== false) { exit(-1); } else { $tags[] = $tag; - $orig = clone($sn); - $sn->tags = implode('|', $tags); - $result = $sn->update($orig); + $result = $sn->setTags($tags); if (!$result) { print "Couldn't update.\n"; exit(-1); diff --git a/scripts/setup_status_network.sh b/scripts/setup_status_network.sh index 4ebb696c7..3dd739030 100755 --- a/scripts/setup_status_network.sh +++ b/scripts/setup_status_network.sh @@ -44,8 +44,8 @@ mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS GRANT ALL ON $database.* TO '$username'@'localhost' IDENTIFIED BY '$password'; GRANT ALL ON $database.* TO '$username'@'%' IDENTIFIED BY '$password'; -INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created, tags) -VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now(), '$tags'); +INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created) +VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now()); ENDOFCOMMANDS @@ -56,6 +56,8 @@ done php $PHPBASE/scripts/checkschema.php -s"$server" +php $PHPBASE/scripts/settag.php -s"$server" "$nickname" "$tags" + php $PHPBASE/scripts/registeruser.php \ -s"$server" \ -n"$nickname" \ -- cgit v1.2.3-54-g00ecf From a6b1feb08cbd3f7bd3f83a31c449b5a4ca8965f0 Mon Sep 17 00:00:00 2001 From: James Walker Date: Wed, 28 Jul 2010 11:43:47 -0400 Subject: leaving tags column in (for now) --- db/site.sql | 2 ++ 1 file changed, 2 insertions(+) (limited to 'db') diff --git a/db/site.sql b/db/site.sql index bc425841d..f87995b94 100644 --- a/db/site.sql +++ b/db/site.sql @@ -16,6 +16,8 @@ create table status_network ( theme varchar(255) comment 'theme name', logo varchar(255) comment 'site logo', + tags text comment 'site meta-info tags (pipe-separated)', + created datetime not null comment 'date this record was created', modified timestamp comment 'date this record was modified' -- cgit v1.2.3-54-g00ecf From 4853b1e2a029a844d0c92e6ad5f2a9e8c51b785c Mon Sep 17 00:00:00 2001 From: James Walker Date: Wed, 28 Jul 2010 11:50:04 -0400 Subject: SQL script to update status_network table --- db/site_093to094.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 db/site_093to094.sql (limited to 'db') diff --git a/db/site_093to094.sql b/db/site_093to094.sql new file mode 100644 index 000000000..30cea31df --- /dev/null +++ b/db/site_093to094.sql @@ -0,0 +1,13 @@ +alter table status_network + drop primary key, + add column site_id integer auto_increment primary key first, + add unique key (nickname); + +create table status_network_tag ( + site_id integer comment 'unique id', + tag varchar(64) comment 'tag name', + created datetime not null comment 'date the record was created', + + constraint primary key (site_id, tag) +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; + -- cgit v1.2.3-54-g00ecf