return array(
'fields' => array(
'id' => array('type' => 'int', 'not null' => true, 'description' => 'should be set from root notice id (since 2014-03-01 commit)'),
- 'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'URI of the conversation'),
+ 'uri' => array('type' => 'varchar', 'not null'=>true, 'length' => 255, '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'),
),
*
* @return Conversation the new conversation DO
*/
- static function create(Notice $notice)
+ static function create(Notice $notice, $uri=null)
{
if (empty($notice->id)) {
throw new ServerException(_('Tried to create conversation for not yet inserted notice'));
$conv = new Conversation();
$conv->created = common_sql_now();
$conv->id = $notice->id;
- $conv->uri = sprintf('%s%s=%d:%s=%s',
+ $conv->uri = $uri ?: sprintf('%s%s=%d:%s=%s:%s=%x',
TagURI::mint(),
'noticeId', $notice->id,
- 'objectType', 'thread');
+ 'objectType', 'thread',
+ 'crc32', crc32($notice->content));
$result = $conv->insert();
if ($result === false) {