t("Stores individual Twitter posts."), 'fields' => array( 'twitter_id' => array( 'description' => t("Unique identifier for each {twitter} post."), 'type' => 'int', 'not null' => TRUE ), 'screen_name' => array( 'description' => t("Screen name of the {twitter} user."), 'type' => 'varchar', 'length' => 255 ), 'created_at' => array( 'description' => t("Date and time the {twitter} post was created."), 'type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => '' ), 'created_time' => array( 'description' => t("A duplicate of {twitter}.created_at in UNIX timestamp format."), 'type' => 'int', 'not null' => TRUE ), 'text' => array( 'description' => t("The text of the {twitter} post."), 'type' => 'varchar', 'length' => 255, 'not null' => FALSE ), 'source' => array( 'description' => t("The application that created the {twitter} post."), 'type' => 'varchar', 'length' => 255, 'not null' => FALSE ), ), 'indexes' => array('screen_name' => array('screen_name')), 'primary key' => array('twitter_id'), ); $schema['twitter_account'] = array( 'description' => t("Stores information on specific Twitter user accounts."), 'fields' => array( 'twitter_uid' => array( 'description' => t("The unique identifier of the {twitter_account}."), 'type' => 'int', 'not null' => TRUE ), 'screen_name' => array( 'description' => t("The unique login name of the {twitter_account} user."), 'type' => 'varchar', 'length' => 255 ), 'name' => array( 'description' => t("The full name of the {twitter_account} user."), 'type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => '' ), 'description' => array( 'description' => t("The description/biography associated with the {twitter_account}."), 'type' => 'varchar', 'length' => 255 ), 'location' => array( 'description' => t("The location of the {twitter_account}'s owner."), 'type' => 'varchar', 'length' => 255 ), 'followers_count' => array( 'description' => t("The number of users following this {twitter_account}."), 'type' => 'int', 'not null' => TRUE, 'default' => 0 ), 'profile_image_url' => array( 'description' => t("The url of the {twitter_account}'s profile image."), 'type' => 'varchar', 'length' => 255 ), 'url' => array( 'description' => t("The url of the {twitter_account}'s home page."), 'type' => 'varchar', 'length' => 255 ), 'protected' => array( 'description' => t("Boolean flag indicating whether the {twitter_account}'s posts are publicly accessible."), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 ), 'last_refresh' => array( 'description' => t("A UNIX timestamp marking the date Twitter statuses were last fetched on."), 'type' => 'int', 'not null' => TRUE ), ), 'indexes' => array('screen_name' => array('screen_name')), 'primary key' => array('twitter_uid'), ); $schema['twitter_user'] = array( 'fields' => array( 'uid' => array( 'description' => t("The Drupal ID of the user account associated with the Twitter account."), 'type' => 'int', 'not null' => TRUE ), 'screen_name' => array( 'description' => t("The unique login name for the Twitter account."), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, ), 'password' => array( 'description' => t("The password for the Twitter account."), 'type' => 'varchar', 'length' => 64 ), 'import' => array( 'description' => t("Boolean flag indicating whether the {twitter_user}'s posts should be pulled in by the site."), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 1 ), ), 'primary key' => array('uid', 'screen_name'), 'indexes' => array('screen_name' => array('screen_name'), 'uid' => array('uid'), 'import' => array('import')), ); return $schema; } /** * Implementation of hook_install(). */ function twitter_install() { // Create tables. drupal_install_schema('twitter'); // Set the weight to 3, making it heaving than Pathauto. db_query("UPDATE {system} SET weight = 3 WHERE name = 'twitter'"); } /** * Previous versions of the Twitter module had no database schema. * We're safe just running the basic install for update_1. */ function twitter_update_6000() { twitter_install(); } /** * Adding a handful of additional flags on accounts, and saving more metadata * when Twitter sends it to us. */ function twitter_update_6001() { $ret = array(); $attributes = array( 'description' => t("Boolean flag indicating whether the {twitter_user}'s posts should be pulled in by the site."), 'unsigned' => TRUE, 'default' => 1, 'not null' => TRUE, ); db_add_column($ret, 'twitter_user', 'import', 'int', $attributes); $attributes = array( 'description' => t("The location of the {twitter_account}'s owner."), 'length' => 255 ); db_add_column($ret, 'twitter_account', 'location', 'varchar(255)', $attributes); $attributes = array( 'description' => t("The number of users following this {twitter_account}."), 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 ); db_add_column($ret, 'twitter_account', 'followers_count', 'int', $attributes); return $ret; } /** * Set the weight a little heavier to allow Pathauto and other modules to do * their work on the title, path alias, etc. before the twitter post is sent. */ function twitter_update_6002() { $ret = array(); $ret[] = update_sql("UPDATE {system} SET weight = 3 WHERE name = 'twitter'"); return $ret; } function twitter_uninstall() { // Remove tables. drupal_uninstall_schema('twitter'); }