You are here

oembedcore.install in oEmbed 6.0

Install file for the oembed core

File

oembedcore.install
View source
<?php

/**
 * @file
 * Install file for the oembed core
 */

/**
 * Implementation of hook_install().
 */
function oembedcore_install() {
  drupal_install_schema('oembedcore');
}

/**
 * Implementation of hook_uninstall().
 */
function oembedcore_uninstall() {
  drupal_uninstall_schema('oembedcore');
}

/**
 * Implementation of hook_schema().
 */
function oembedcore_schema() {
  $schema['oembedcore_preset'] = _oembedcore_preset_schema_1();
  $schema['oembedcore_provider'] = _oembedcore_provider_schema_1();
  return $schema;
}
function _oembedcore_preset_schema_1() {
  return array(
    'export' => array(
      'identifier' => 'preset',
      'primary key' => 'pid',
    ),
    'fields' => array(
      'pid' => array(
        'type' => 'serial',
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        'not null' => TRUE,
        'no export' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 255,
        'description' => 'Unique ID for this subtask. Used to identify it programmatically.',
        'not null' => TRUE,
        'default' => '',
      ),
      'width' => array(
        'type' => 'int',
        'description' => 'The maximum width of the embed.',
        'not null' => TRUE,
        'default' => 0,
      ),
      'height' => array(
        'type' => 'int',
        'description' => 'The maximum height of the embed.',
        'not null' => TRUE,
        'default' => 0,
      ),
      'conf' => array(
        'type' => 'text',
        'size' => 'big',
        'description' => 'Serialized configuration of the embed, if needed.',
        'not null' => TRUE,
        'serialize' => TRUE,
        'object default' => array(),
      ),
    ),
    'primary key' => array(
      'pid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
}
function _oembedcore_provider_schema_1() {
  return array(
    'export' => array(
      'identifier' => 'provider',
      'primary key' => 'pid',
    ),
    'fields' => array(
      'pid' => array(
        'type' => 'serial',
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        'not null' => TRUE,
        'no export' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 255,
        'description' => 'Unique ID for this subtask. Used to identify it programmatically.',
        'not null' => TRUE,
        'default' => '',
      ),
      'title' => array(
        'description' => 'The human-readable title of the provider.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'endpoint' => array(
        'type' => 'varchar',
        'length' => 255,
        'description' => 'The endpoint for this provider.',
        'not null' => TRUE,
        'default' => '',
      ),
      'scheme' => array(
        'type' => 'text',
        'size' => 'big',
        'description' => 'Line separated scheme definition.',
        'not null' => TRUE,
        'serialize' => TRUE,
        'object default' => '',
      ),
    ),
    'primary key' => array(
      'pid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
}
function oembedcore_update_6001() {
  $ret = array();
  $schema = _oembedcore_preset_schema_1();
  db_create_table($ret, 'oembedcore_preset', $schema);
  return $ret;
}
function oembedcore_update_6002() {
  $ret = array();
  $schema = _oembedcore_provider_schema_1();
  db_create_table($ret, 'oembedcore_provider', $schema);
  return $ret;
}