You are here

function sweaver_schema in Sweaver 6

Same name and namespace in other branches
  1. 7 sweaver.install \sweaver_schema()

Implementation of hook_schema().

File

./sweaver.install, line 175
Sweaver install file.

Code

function sweaver_schema() {

  // Styles table.
  $schema['sweaver_style'] = array(
    'description' => t('Storage for the css array'),
    'fields' => array(
      'style_id' => array(
        'description' => 'The primary identifier for a theme style. Linked to style_id from the draft table.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'theme' => array(
        'description' => 'The theme name',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'style' => array(
        'description' => 'The style name',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'css' => array(
        'description' => 'The css object',
        'type' => 'text',
        'size' => 'big',
      ),
      'customcss' => array(
        'description' => 'Custom css',
        'type' => 'text',
        'size' => 'big',
      ),
      'palette' => array(
        'description' => 'Palette',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'themesettings' => array(
        'description' => 'Theme settings',
        'type' => 'text',
        'size' => 'big',
      ),
      'active' => array(
        'description' => 'Should this style be active?',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'style_id',
    ),
  );

  // Styles draft table
  $schema['sweaver_style_draft'] = array(
    'description' => t('Storage for the css array'),
    'fields' => array(
      'style_id' => array(
        'description' => 'The primary identifier for a theme style.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'theme' => array(
        'description' => 'The theme name',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'style' => array(
        'description' => 'The style name',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'css' => array(
        'description' => 'The css object',
        'type' => 'text',
        'size' => 'big',
      ),
      'customcss' => array(
        'description' => 'Custom css',
        'type' => 'text',
        'size' => 'big',
      ),
      'palette' => array(
        'description' => 'Palette',
        'type' => 'text',
        'size' => 'big',
      ),
      'themesettings' => array(
        'description' => 'Theme settings',
        'type' => 'text',
        'size' => 'big',
      ),
    ),
    'primary key' => array(
      'style_id',
    ),
  );

  // Images table.
  $schema['sweaver_image'] = array(
    'description' => t('Table storing images.'),
    'fields' => array(
      'fid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'The image fid.',
        'default' => 0,
      ),
      'description' => array(
        'type' => 'varchar',
        'length' => '40',
        'description' => 'A human readable name of the image.',
      ),
    ),
  );

  // Selector table width CTools support.
  $schema['sweaver_selector'] = array(
    'description' => t('Table storing selector definitions.'),
    'export' => array(
      'key' => 'name',
      'identifier' => 'selector',
      'default hook' => 'default_sweaver_selector',
      'list callback' => 'sweaver_ctools_selectors_list',
      'can disable' => TRUE,
      'api' => array(
        'owner' => 'sweaver',
        'api' => 'sweaver',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'oid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        'no export' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => '40',
        'description' => 'Unique ID for selectors. Used to identify them programmatically.',
      ),
      'description' => array(
        'type' => 'varchar',
        'length' => '60',
        'description' => 'A human readable name of a selector.',
      ),
      'selector_selector' => array(
        'type' => 'varchar',
        'length' => '120',
        'description' => 'The identifier of the selector',
      ),
      'selector_highlight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => 'Should this selector be highlighted by default',
      ),
    ),
    'primary key' => array(
      'oid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );

  // Property table width CTools support.
  $schema['sweaver_property'] = array(
    'description' => t('Table storing property definitions.'),
    'export' => array(
      'key' => 'name',
      'identifier' => 'property',
      'default hook' => 'default_sweaver_property',
      'list callback' => 'sweaver_ctools_properties_list',
      'can disable' => TRUE,
      'api' => array(
        'owner' => 'sweaver',
        'api' => 'sweaver',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'oid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        'no export' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => '40',
        'description' => 'Unique ID for properties. Used to identify them programmatically.',
      ),
      'description' => array(
        'type' => 'varchar',
        'length' => '60',
        'description' => 'A human readable name of a property.',
      ),
      'property' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => 'The css property. Seperate multiple values by spaces.',
      ),
      'property_parent' => array(
        'type' => 'varchar',
        'length' => '40',
        'description' => 'The parent of this property.',
      ),
      'property_type' => array(
        'type' => 'varchar',
        'length' => '20',
        'description' => 'Type of the property',
      ),
      'property_prefix' => array(
        'type' => 'varchar',
        'length' => '20',
        'description' => 'Prefix of the property',
      ),
      'property_suffix' => array(
        'type' => 'varchar',
        'length' => '20',
        'description' => 'Suffix of the property',
      ),
      'property_slider_min' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
        'description' => 'Minimum value for the slider',
      ),
      'property_slider_max' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 72,
        'description' => 'Maximum value for the slider',
      ),
      'property_options' => array(
        'description' => 'Options for this property',
        'type' => 'text',
        'size' => 'big',
      ),
    ),
    'primary key' => array(
      'oid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );

  // Type table width CTools support.
  $schema['sweaver_type'] = array(
    'description' => t('Table storing type definitions.'),
    'export' => array(
      'key' => 'name',
      'identifier' => 'type',
      'default hook' => 'default_sweaver_type',
      'list callback' => 'sweaver_ctools_types_list',
      'can disable' => TRUE,
      'api' => array(
        'owner' => 'sweaver',
        'api' => 'sweaver',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'oid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        'no export' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => '40',
        'description' => 'Unique ID for types. Used to identify them programmatically.',
      ),
      'description' => array(
        'type' => 'varchar',
        'length' => '60',
        'description' => 'A human readable name of a type.',
      ),
      'type_options' => array(
        'description' => 'Options for this type',
        'type' => 'text',
        'size' => 'big',
      ),
    ),
    'primary key' => array(
      'oid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  return $schema;
}