]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - db/core.php
add an index for site tags
[quix0rs-gnu-social.git] / db / core.php
index 62730b853f7e8ed61845f205bb8f1bde02f815f7..10d8e51b9bf25b7e6e955014da09ec62a1705292 100644 (file)
@@ -118,10 +118,12 @@ $schema['user'] = array(
         'smsemail' => array('type' => 'varchar', 'length' => 255, 'description' => 'built from sms and carrier'),
         'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universally unique identifier, usually a tag URI'),
         'autosubscribe' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'automatically subscribe to users who subscribe to us'),
+        'subscribe_policy' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => '0 = anybody can subscribe; 1 = require approval'),
         'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'),
         'inboxed' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'has an inbox been created for this user?'),
         'design_id' => array('type' => 'int', 'description' => 'id of a design'),
         'viewdesigns' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'whether to view user-provided designs'),
+        'private_stream' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'whether to limit all notices to followers only'),
 
         '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'),
@@ -201,7 +203,10 @@ $schema['notice'] = array(
         'location_id' => array('type' => 'int', 'description' => 'location id if possible'),
         'location_ns' => array('type' => 'int', 'description' => 'namespace for location'),
         'repeat_of' => array('type' => 'int', 'description' => 'notice this is a repeat of'),
-        'object_type' => array('type' => 'varchar', 'length' => 32, 'description' => 'URI representing activity streams object type'),
+        'object_type' => array('type' => 'varchar', 'length' => 255, 'description' => 'URI representing activity streams object type', 'default' => 'http://activitystrea.ms/schema/1.0/note'),
+        'scope' => array('type' => 'int',
+                         'default' => '1',
+                         'description' => 'bit map for distribution scope; 0 = everywhere; 1 = this server only; 2 = addressees; 4 = followers'),
     ),
     'primary key' => array('id'),
     'unique keys' => array(
@@ -605,8 +610,9 @@ $schema['profile_tag'] = array(
     ),
     'primary key' => array('tagger', 'tagged', 'tag'),
     'foreign keys' => array(
-        'profile_tag_tagger_fkey' => array('user', array('tagger' => 'id')),
+        'profile_tag_tagger_fkey' => array('profile', array('tagger' => 'id')),
         'profile_tag_tagged_fkey' => array('profile', array('tagged' => 'id')),
+        'profile_tag_tag_fkey' => array('profile_list', array('tag' => 'tag')),
     ),
     'indexes' => array(
         'profile_tag_modified_idx' => array('modified'),
@@ -615,6 +621,76 @@ $schema['profile_tag'] = array(
     ),
 );
 
+$schema['profile_list'] = array(
+    'fields' => array(
+        'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'),
+        'tagger' => array('type' => 'int', 'not null' => true, 'description' => 'user making the tag'),
+        'tag' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'people tag'),
+        'description' => array('type' => 'text', 'description' => 'description of the people tag'),
+        'private' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'is this tag private'),
+
+        'created' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was added'),
+        'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was modified'),
+
+        'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universal identifier'),
+        'mainpage' => array('type' => 'varchar', 'length' => 255, 'description' => 'page to link to'),
+        'tagged_count' => array('type' => 'int', 'default' => 0, 'description' => 'number of people tagged with this tag by this user'),
+        'subscriber_count' => array('type' => 'int', 'default' => 0, 'description' => 'number of subscribers to this tag'),
+    ),
+    'primary key' => array('tagger', 'tag'),
+    'unique keys' => array(
+      'profile_list_id_key' => array('id')
+    ),
+    'foreign keys' => array(
+        'profile_list_tagger_fkey' => array('profile', array('tagger' => 'id')),
+    ),
+    'indexes' => array(
+        'profile_list_modified_idx' => array('modified'),
+        'profile_list_tag_idx' => array('tag'),
+        'profile_list_tagger_tag_idx' => array('tagger', 'tag'),
+        'profile_list_tagged_count_idx' => array('tagged_count'),
+        'profile_list_subscriber_count_idx' => array('subscriber_count'),
+    ),
+);
+
+$schema['profile_tag_inbox'] = array(
+    'description' => 'Many-many table listing notices associated with people tags.',
+    'fields' => array(
+        'profile_tag_id' => array('type' => 'int', 'not null' => true, 'description' => 'people tag 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('profile_tag_id', 'notice_id'),
+    'foreign keys' => array(
+        'profile_tag_inbox_profile_list_id_fkey' => array('profile_list', array('profile_tag_id' => 'id')),
+        'profile_tag_inbox_notice_id_fkey' => array('notice', array('notice_id' => 'id')),
+    ),
+    'indexes' => array(
+        'profile_tag_inbox_created_idx' => array('created'),
+        'profile_tag_inbox_profile_tag_id_idx' => array('profile_tag_id'),
+    ),
+);
+
+$schema['profile_tag_subscription'] = array(
+    'fields' => array(
+        'profile_tag_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile_tag'),
+        'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'),
+
+        '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_tag_id', 'profile_id'),
+    'foreign keys' => array(
+        'profile_tag_subscription_profile_list_id_fkey' => array('profile_list', array('profile_tag_id' => 'id')),
+        'profile_tag_subscription_profile_id_fkey' => array('profile', array('profile_id' => 'id')),
+    ),
+    'indexes' => array(
+        // @fixme probably we want a (profile_id, created) index here?
+        'profile_tag_subscription_profile_id_idx' => array('profile_id'),
+        'profile_tag_subscription_created_idx' => array('created'),
+    ),
+);
+
 $schema['profile_block'] = array(
     'fields' => array(
         'blocker' => array('type' => 'int', 'not null' => true, 'description' => 'user making the block'),
@@ -649,6 +725,8 @@ $schema['user_group'] = array(
 
         'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universal identifier'),
         'mainpage' => array('type' => 'varchar', 'length' => 255, 'description' => 'page for group info to link to'),
+        'join_policy' => array('type' => 'int', 'size' => 'tiny', 'description' => '0=open; 1=requires admin approval'),      
+        'force_scope' => array('type' => 'int', 'size' => 'tiny', 'description' => '0=never,1=sometimes,-1=always'),
     ),
     'primary key' => array('id'),
     'unique keys' => array(
@@ -1025,3 +1103,7 @@ $schema['schema_version'] = array(
     ),
     'primary key' => array('table_name'),
 );
+
+$schema['group_join_queue'] = Group_join_queue::schemaDef();
+
+$schema['subscription_queue'] = Subscription_queue::schemaDef();