You are here

function fb_autopost_entity_schema in Facebook Autopost 7

Implements hook_schema().

File

fb_autopost_entity/fb_autopost_entity.install, line 11
Install, update and uninstall functions for the Facebook publication module.

Code

function fb_autopost_entity_schema() {
  $schema['facebook_publication'] = array(
    'description' => 'Stores Facebook publication items.',
    'fields' => array(
      'fbpid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique Facebook publication item ID.',
      ),
      'type' => array(
        'description' => 'The {facebook_publication_type}.type of this Facebook publication.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
        'default' => NULL,
        'description' => "The {users}.uid of the associated user.",
      ),
      'facebook_id' => array(
        'type' => 'varchar',
        'length' => 255,
        'description' => "The id returned by Facebook after a successful publication.",
      ),
      'label' => array(
        'description' => 'A human-readable label for this Facebook publication.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'created' => array(
        'description' => 'The Unix timestamp when the Facebook publication was created.',
        'type' => 'int',
        'not null' => FALSE,
      ),
      'changed' => array(
        'description' => 'The Unix timestamp when the Facebook publication was most recently saved.',
        'type' => 'int',
        'not null' => FALSE,
      ),
    ),
    'indexes' => array(
      'uid' => array(
        'uid',
      ),
    ),
    'foreign keys' => array(
      'uid' => array(
        'table' => 'users',
        'columns' => array(
          'uid' => 'uid',
        ),
      ),
      'type' => array(
        'table' => 'facebook_publication_type',
        'columns' => array(
          'type' => 'type',
        ),
      ),
    ),
    'primary key' => array(
      'fbpid',
    ),
  );
  $schema['facebook_publication_type'] = array(
    'description' => 'Stores information about all defined Facebook publication types.',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique Facebook publication type ID.',
      ),
      'type' => array(
        'description' => 'The machine-readable name of this Facebook publication type.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
      'label' => array(
        'description' => 'The human-readable name of this Facebook publication type.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => 'The weight of this Facebook publication type in relation to others.',
      ),
      'description' => array(
        'type' => 'text',
        'not null' => FALSE,
        'description' => 'A short description of this Facebook publication type.',
      ),
      'data' => array(
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'big',
        'serialize' => TRUE,
        'description' => 'A serialized array of additional data related to this Facebook publication type.',
      ),
      'status' => array(
        'type' => 'int',
        'not null' => TRUE,
        // Set the default to ENTITY_CUSTOM without using the constant as it is
        // not safe to use it at this point.
        'default' => 0x1,
        'size' => 'tiny',
        'description' => 'The exportable status of the entity.',
      ),
      'module' => array(
        'description' => 'The name of the providing module if the entity has been defined in code.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'unique keys' => array(
      'type' => array(
        'type',
      ),
    ),
  );
  return $schema;
}