X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=db%2Fcore.php;h=ab1f1597433fb02d54c2ccfc6ccea6715af9d8a8;hb=e862dcdb8a9cfc21cf00513d76f40d20dd3b1b7a;hp=9be793ffb85d3a9f10f0b66ddc9688a1ba4ce860;hpb=b635c75639f5119d89a7f228155466a80d7ba185;p=quix0rs-gnu-social.git diff --git a/db/core.php b/db/core.php index 9be793ffb8..ab1f159743 100644 --- a/db/core.php +++ b/db/core.php @@ -13,7 +13,8 @@ * MySQL 'timestamp' columns were formerly used for 'modified' files for their * auto-updating properties. This didn't play well with changes to cache usage * in 0.9.x, as we don't know the timestamp value at INSERT time and never - * have a chance to load it up again before caching. + * have a chance to load it up again before caching. For now I'm leaving them + * in, but we may want to clean them up later. * * Current code should be setting 'created' and 'modified' fields explicitly; * this also avoids mismatches between server and client timezone settings. @@ -44,7 +45,7 @@ $schema['profile'] = array( 'location_ns' => array('type' => 'int', 'description' => 'namespace for location'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('id'), 'indexes' => array( @@ -65,7 +66,7 @@ $schema['avatar'] = array( 'filename' => array('type' => 'varchar', 'length' => 255, 'description' => 'local filename, if local'), 'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'avatar location'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('profile_id', 'width', 'height'), 'unique keys' => array( @@ -85,7 +86,7 @@ $schema['sms_carrier'] = array( 'name' => array('type' => 'varchar', 'length' => 64, 'description' => 'name of the carrier'), 'email_pattern' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'sprintf pattern for making an email address from a phone number'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('id'), 'unique keys' => array( @@ -117,13 +118,14 @@ $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'), - 'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'ur1.ca', 'description' => 'service to use for auto-shortening URLs'), + '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'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('id'), 'unique keys' => array( @@ -151,7 +153,7 @@ $schema['remote_profile'] = array( 'postnoticeurl' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL we use for posting notices'), 'updateprofileurl' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL we use for updates to this profile'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('id'), 'unique keys' => array( @@ -171,7 +173,7 @@ $schema['subscription'] = array( 'token' => array('type' => 'varchar', 'length' => 255, 'description' => 'authorization token'), 'secret' => array('type' => 'varchar', 'length' => 255, 'description' => 'token secret'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('subscriber', 'subscribed'), 'indexes' => array( @@ -190,7 +192,7 @@ $schema['notice'] = array( 'rendered' => array('type' => 'text', 'description' => 'HTML version of the content'), 'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL of any attachment (image, video, bookmark, whatever)'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), 'reply_to' => array('type' => 'int', 'description' => 'notice replied to (usually a guess)'), 'is_local' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'notice was generated by a user'), 'source' => array('type' => 'varchar', 'length' => 32, 'description' => 'source of comment, like "web", "im", or "clientname"'), @@ -200,6 +202,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' => 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( @@ -229,7 +235,8 @@ $schema['notice_source'] = array( 'name' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'name of the source'), 'url' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'url to link to'), 'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + '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('code'), ); @@ -238,7 +245,7 @@ $schema['reply'] = array( 'fields' => array( 'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice that is the reply'), 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'profile replied to'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), 'replied_id' => array('type' => 'int', 'description' => 'notice replied to (not used, see notice.reply_to)'), ), 'primary key' => array('notice_id', 'profile_id'), @@ -257,7 +264,7 @@ $schema['fave'] = array( 'fields' => array( 'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice that is the favorite'), 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who likes this notice'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('notice_id', 'user_id'), 'foreign keys' => array( @@ -281,7 +288,7 @@ $schema['consumer'] = array( 'seed' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'seed for new tokens by this consumer'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('consumer_key'), ); @@ -298,7 +305,7 @@ $schema['token'] = array( 'verified_callback' => array('type' => 'varchar', 'length' => 255, 'description' => 'verified callback URL for OAuth 1.0a'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('consumer_key', 'tok'), 'foreign keys' => array( @@ -315,7 +322,7 @@ $schema['nonce'] = array( 'ts' => array('type' => 'datetime', 'not null' => true, 'description' => 'timestamp sent'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('consumer_key', 'ts', 'nonce'), ); @@ -336,7 +343,7 @@ $schema['oauth_application'] = array( 'type' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'type of app, 1 = browser, 2 = desktop'), 'access_type' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'default access type, bit 1 = read, bit 2 = write'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('id'), 'unique keys' => array( @@ -355,7 +362,7 @@ $schema['oauth_application_user'] = array( 'access_type' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'access type, bit 1 = read, bit 2 = write'), 'token' => array('type' => 'varchar', 'length' => 255, 'description' => 'request or access token'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('profile_id', 'application_id'), 'foreign keys' => array( @@ -398,7 +405,7 @@ $schema['confirm_address'] = array( 'address_type' => array('type' => 'varchar', 'length' => 8, 'not null' => true, 'description' => 'address type ("email", "xmpp", "sms")'), 'claimed' => array('type' => 'datetime', 'description' => 'date this was claimed for queueing'), 'sent' => array('type' => 'datetime', 'description' => 'date this was sent for queueing'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('code'), 'foreign keys' => array( @@ -410,7 +417,7 @@ $schema['remember_me'] = array( 'fields' => array( 'code' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'good random code'), 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who is logged in'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('code'), 'foreign keys' => array( @@ -457,7 +464,7 @@ $schema['foreign_service'] = array( 'name' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'name of the service'), 'description' => array('type' => 'varchar', 'length' => 255, 'description' => 'description'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('id'), 'unique keys' => array( @@ -472,7 +479,7 @@ $schema['foreign_user'] = array( 'uri' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'identifying URI'), 'nickname' => array('type' => 'varchar', 'length' => 255, 'description' => 'nickname on foreign service'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('id', 'service'), 'foreign keys' => array( @@ -495,7 +502,7 @@ $schema['foreign_link'] = array( 'last_noticesync' => array('type' => 'datetime', 'description' => 'last time notices were imported'), 'last_friendsync' => array('type' => 'datetime', 'description' => 'last time friends were imported'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('user_id', 'foreign_id', 'service'), 'foreign keys' => array( @@ -511,8 +518,8 @@ $schema['foreign_link'] = array( $schema['foreign_subscription'] = array( 'fields' => array( 'service' => array('type' => 'int', 'not null' => true, 'description' => 'service where relationship happens'), - 'subscriber' => array('type' => 'int', 'not null' => true, 'description' => 'subscriber on foreign service'), - 'subscribed' => array('type' => 'int', 'not null' => true, 'description' => 'subscribed user'), + 'subscriber' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'subscriber on foreign service'), + 'subscribed' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'subscribed user'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), ), 'primary key' => array('service', 'subscriber', 'subscribed'), @@ -555,7 +562,7 @@ $schema['message'] = array( 'rendered' => array('type' => 'text', 'description' => 'HTML version of the content'), 'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL of any attachment (image, video, bookmark, whatever)'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), 'source' => array('type' => 'varchar', 'length' => 32, 'description' => 'source of comment, like "web", "im", or "clientname"'), ), 'primary key' => array('id'), @@ -598,7 +605,7 @@ $schema['profile_tag'] = array( 'tagger' => array('type' => 'int', 'not null' => true, 'description' => 'user making the tag'), 'tagged' => array('type' => 'int', 'not null' => true, 'description' => 'profile tagged'), 'tag' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this notice'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the tag was added'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was added'), ), 'primary key' => array('tagger', 'tagged', 'tag'), 'foreign keys' => array( @@ -616,7 +623,7 @@ $schema['profile_block'] = array( 'fields' => array( 'blocker' => array('type' => 'int', 'not null' => true, 'description' => 'user making the block'), 'blocked' => array('type' => 'int', 'not null' => true, 'description' => 'profile that is blocked'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date of blocking'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date of blocking'), ), 'foreign keys' => array( 'profile_block_blocker_fkey' => array('user', array('blocker' => 'id')), @@ -642,10 +649,11 @@ $schema['user_group'] = array( 'design_id' => array('type' => 'int', 'description' => 'id of a design'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), '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'), ), 'primary key' => array('id'), 'unique keys' => array( @@ -666,7 +674,7 @@ $schema['group_member'] = array( 'is_admin' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'is this user an admin?'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('group_id', 'profile_id'), 'foreign keys' => array( @@ -724,7 +732,7 @@ $schema['file'] = array( 'protected' => array('type' => 'int', 'description' => 'true when URL is private (needs login)'), 'filename' => array('type' => 'varchar', 'length' => 255, 'description' => 'if a local file, name of the file'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('id'), 'unique keys' => array( @@ -747,7 +755,7 @@ $schema['file_oembed'] = array( 'author_name' => array('type' => 'varchar', 'length' => 50, 'description' => 'author name for this oEmbed resource'), 'author_url' => array('type' => 'varchar', 'length' => 255, 'description' => 'author URL for this oEmbed resource'), 'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL for this oEmbed resource when applicable (photo, link)'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('file_id'), 'foreign keys' => array( @@ -761,7 +769,7 @@ $schema['file_redirection'] = array( 'file_id' => array('type' => 'int', 'description' => 'short URL for what URL/file'), 'redirections' => array('type' => 'int', 'description' => 'redirect count'), 'httpcode' => array('type' => 'int', 'description' => 'HTTP status code (20x, 30x, etc.)'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('url'), 'foreign keys' => array( @@ -775,7 +783,7 @@ $schema['file_thumbnail'] = array( 'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL of thumbnail'), 'width' => array('type' => 'int', 'description' => 'width of thumbnail'), 'height' => array('type' => 'int', 'description' => 'height of thumbnail'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('file_id'), 'foreign keys' => array( @@ -790,7 +798,7 @@ $schema['file_to_post'] = array( 'fields' => array( 'file_id' => array('type' => 'int', 'not null' => true, 'description' => 'id of URL/file'), 'post_id' => array('type' => 'int', 'not null' => true, 'description' => 'id of the notice it belongs to'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('file_id', 'post_id'), 'foreign keys' => array( @@ -821,7 +829,7 @@ $schema['group_block'] = array( 'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'), 'blocked' => array('type' => 'int', 'not null' => true, 'description' => 'profile that is blocked'), 'blocker' => array('type' => 'int', 'not null' => true, 'description' => 'user making the block'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date of blocking'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date of blocking'), ), 'primary key' => array('group_id', 'blocked'), 'foreign keys' => array( @@ -835,7 +843,7 @@ $schema['group_alias'] = array( 'fields' => array( 'alias' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'additional nickname for the group'), 'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date alias was created'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date alias was created'), ), 'primary key' => array('alias'), 'foreign keys' => array( @@ -851,7 +859,7 @@ $schema['session'] = array( 'id' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'session ID'), 'session_data' => array('type' => 'text', 'description' => 'session data'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('id'), 'indexes' => array( @@ -902,7 +910,7 @@ $schema['location_namespace'] = array( 'id' => array('type' => 'int', 'not null' => true, 'description' => 'identity for this namespace'), 'description' => array('type' => 'varchar', 'length' => 255, 'description' => 'description of the namespace'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('id'), ); @@ -912,7 +920,7 @@ $schema['login_token'] = array( 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user owning this token'), 'token' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'token useable for logging in'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('user_id'), 'foreign keys' => array( @@ -925,7 +933,7 @@ $schema['user_location_prefs'] = array( 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who has the preference'), 'share_location' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Whether to share location data'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('user_id'), 'foreign keys' => array( @@ -955,7 +963,7 @@ $schema['user_im_prefs'] = array( 'microid' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'Publish a MicroID'), 'updatefrompresence' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Send replies from people not subscribed to.'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('user_id', 'transport'), 'unique keys' => array( @@ -971,7 +979,7 @@ $schema['conversation'] = array( 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'), 'uri' => array('type' => 'varchar', 'length' => 225, 'description' => 'URI of the conversation'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('id'), 'unique keys' => array( @@ -986,7 +994,7 @@ $schema['local_group'] = array( 'nickname' => array('type' => 'varchar', 'length' => 64, 'description' => 'group represented'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('group_id'), 'foreign keys' => array( @@ -1000,15 +1008,29 @@ $schema['local_group'] = array( $schema['user_urlshortener_prefs'] = array( 'fields' => array( 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user'), - 'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'ur1.ca', 'description' => 'service to use for auto-shortening URLs'), + 'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'), 'maxurllength' => array('type' => 'int', 'not null' => true, 'description' => 'urls greater than this length will be shortened, 0 = always, null = never'), 'maxnoticelength' => array('type' => 'int', 'not null' => true, 'description' => 'notices with content greater than this value will have all urls shortened, 0 = always, null = never'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), - 'modified' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was modified'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), ), 'primary key' => array('user_id'), 'foreign keys' => array( 'user_urlshortener_prefs_user_id_fkey' => array('user', array('user_id' => 'id')), ), ); + +$schema['schema_version'] = array( + 'description' => 'To avoid checking database structure all the time, we store a checksum of the expected schema info for each table here. If it has not changed since the last time we checked the table, we can leave it as is.', + 'fields' => array( + 'table_name' => array('type' => 'varchar', 'length' => '64', 'not null' => true, 'description' => 'Table name'), + 'checksum' => array('type' => 'varchar', 'length' => '64', 'not null' => true, 'description' => 'Checksum of schema array; a mismatch indicates we should check the table more thoroughly.'), + 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'), + ), + 'primary key' => array('table_name'), +); + +$schema['group_join_queue'] = Group_join_queue::schemaDef(); + +$schema['subscription_queue'] = Subscription_queue::schemaDef();