You are here

function eu_cookie_compliance_schema in EU Cookie Compliance (GDPR Compliance) 7.2

Same name and namespace in other branches
  1. 8 eu_cookie_compliance.install \eu_cookie_compliance_schema()
  2. 7 eu_cookie_compliance.install \eu_cookie_compliance_schema()
  3. 2.0.x eu_cookie_compliance.install \eu_cookie_compliance_schema()

Implements hook_schema().

File

./eu_cookie_compliance.install, line 11
Installation file.

Code

function eu_cookie_compliance_schema() {
  $schema['eu_cookie_compliance_basic_consent'] = array(
    'description' => 'Basic consent storage for EU Cookie Compliance / GDPR.',
    'fields' => array(
      'cid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique consent storage ID.',
      ),
      'uid' => array(
        'description' => '{users}.uid for user.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'timestamp' => array(
        'description' => 'Time of consent.',
        'type' => 'int',
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'ip_address' => array(
        'description' => 'The IP address.',
        'type' => 'varchar',
        // Maximum length of an ipv6 IP address.
        'length' => 45,
        'not null' => TRUE,
        'default' => '',
      ),
      'consent_type' => array(
        'description' => 'The type of consent, such as "banner" for the banner and form_id for forms.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'revision_id' => array(
        'description' => 'Revision of the privacy policy at the time of consent.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'cid',
    ),
    'indexes' => array(
      'uid' => array(
        'uid',
      ),
    ),
    'foreign keys' => array(
      'uid' => array(
        'users' => 'uid',
      ),
    ),
  );
  return $schema;
}