You are here

function eu_cookie_compliance_schema in EU Cookie Compliance (GDPR Compliance) 8

Same name and namespace in other branches
  1. 7.2 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 19
Update scripts for the EU Cookie Compliance module.

Code

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