You are here

function optimizely_schema in Optimizely 8.3

Same name and namespace in other branches
  1. 8 optimizely.install \optimizely_schema()
  2. 8.0 optimizely.install \optimizely_schema()
  3. 7.3 optimizely.install \optimizely_schema()
  4. 7.2 optimizely.install \optimizely_schema()

Implements hook_schema().

Called at both install and uninstall time, creates/deletes a custom table in the database for the Optimizely module.

File

./optimizely.install, line 14
Install, update and uninstall functions for the Optimizely module.

Code

function optimizely_schema() {
  $schema['optimizely'] = [
    'description' => 'This table holds the Optimizely project / experiment
		  entries from the adminstration form.',
    'fields' => [
      'oid' => [
        'description' => 'The unique identifier of each Optimizely
				  project/experiment entry.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'project_title' => [
        'description' => 'The title of each project.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ],
      'include' => [
        'description' => 'Switch to include / exclude Optimizely snippet on
				  specific page paths.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 1,
      ],
      'enabled' => [
        'description' => 'Switch to enabled / disabled Optimizely snippet entry.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ],
      'path' => [
        'description' => 'Serialized array of paths where the Optimizely code
				  snippet appears',
        'type' => 'text',
        'size' => 'normal',
        'not null' => FALSE,
      ],
      'project_code' => [
        'description' => 'Optimizely project code.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => FALSE,
        'default' => '',
      ],
    ],
    'primary key' => [
      'oid',
    ],
  ];
  return $schema;
}