You are here

function zoomapi_schema in Zoom API 7.2

Same name and namespace in other branches
  1. 7 zoomapi.install \zoomapi_schema()

Implements hook_schema().

6 calls to zoomapi_schema()
zoomapi_update_7101 in ./zoomapi.install
Generate the Zoom API meeting tracker tables.
zoomapi_update_7102 in ./zoomapi.install
Add uuid column to meeting tracker table.
zoomapi_update_7204 in ./zoomapi.install
Add meeting_id to recordings tracker table.
zoomapi_update_7205 in ./zoomapi.install
Add realm column to all zoomapi tables.
zoomapi_update_7206 in ./zoomapi.install
Populate recently added realm columns.

... See full list

File

./zoomapi.install, line 301
Install, update, and uninstall hooks for the Zoom API module.

Code

function zoomapi_schema() {
  $schema['zoomapi_meetings_index'] = [
    'description' => 'Retain an index of Zoom meetings for easier lookup not available via APIs.',
    'fields' => [
      'uuid' => [
        'description' => 'The Zoom provided meeting UUID',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ],
      'id' => [
        'description' => 'The Zoom provided meeting ID.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ],
      'host_id' => [
        'description' => 'The meeting host zoom provided user ID.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ],
      'topic' => [
        'description' => 'The meeting topic.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'type' => [
        'description' => 'The Zoom meeting type. (1 instant, 2 normal scheduled, 3 recurring no fixed time, 8 recurring fixed time.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'start_time' => [
        'description' => 'The meeting start timestamp.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => 0,
      ],
      'duration' => [
        'description' => 'The meeting duration (minutes). For scheduled meeting only.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'timezone' => [
        'description' => 'The meeting timezone.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ],
      // @todo need to change 'type' as older mysql versions can't handle the
      // length.
      'start_url' => [
        'description' => 'The meeting host start/join URL.',
        'type' => 'varchar',
        'length' => 2000,
        'not null' => TRUE,
        'default' => '',
      ],
      // @todo need to change 'type' as older mysql versions can't handle the
      // length.
      'join_url' => [
        'description' => 'The meeting participant join URL.',
        'type' => 'varchar',
        'length' => 2000,
        'not null' => TRUE,
        'default' => '',
      ],
      'realm' => [
        'description' => 'The environment, or realm, for this Zoom / Drupal user relationship.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ],
      'created' => [
        'description' => 'The timestamp when this record was created.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'entity_type' => [
        'description' => 'The Drupal entity the meeting was created for.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ],
      'entity_id' => [
        'description' => 'The Drupal entity ID the meeting was created for.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'indexes' => [
      'zoomapi_uuid' => [
        'uuid',
      ],
      'zoomapi_meeting_id' => [
        'id',
      ],
      'zoomapi_host_zoom_user_id' => [
        'host_id',
      ],
      'zoomapi_meeting_type' => [
        'type',
      ],
      'zoomapi_start_time' => [
        'start_time',
      ],
      'zoomapi_created' => [
        'created',
      ],
      'zoomapi_entity_type' => [
        'entity_type',
      ],
      'zoomapi_entity_id' => [
        'entity_id',
      ],
      'realm' => [
        'realm',
      ],
    ],
    'primary key' => [
      'uuid',
    ],
  ];
  $schema['zoomapi_users'] = [
    'description' => 'Track Zoom users with {users}.uid.',
    'fields' => [
      'uid' => [
        'description' => 'The {users}.uid for the Zoom user.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
      'realm' => [
        'description' => 'The environment, or realm, for this Zoom / Drupal user relationship.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ],
      'zoom_user_id' => [
        'description' => 'The Zoom userId',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ],
      'zoom_email' => [
        'description' => 'The email address used on the Zoom user.',
        'type' => 'varchar',
        'length' => 254,
        'not null' => TRUE,
        'default' => '',
      ],
      'created' => [
        'description' => 'The Unix timestamp when this record was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
      'changed' => [
        'description' => 'The Unix timestamp when this record was last changed.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'zoom_email',
    ],
    'unique keys' => [
      'uid_realm' => [
        'uid',
        'realm',
      ],
    ],
    'indexes' => [
      'zoom_user_id' => [
        'zoom_user_id',
      ],
      'zoom_email' => [
        'zoom_email',
      ],
      'realm' => [
        'realm',
      ],
    ],
  ];
  $schema['zoomapi_webhooks_log'] = [
    'description' => 'Log of all incoming webhooks.',
    'fields' => [
      'id' => [
        'description' => 'Primary Key: Unique webhook log id.',
        'type' => 'serial',
        'not null' => TRUE,
      ],
      // @todo need to change 'type' as older mysql versions can't handle the
      // length.
      'url' => [
        'description' => 'The full webhook url.',
        'type' => 'varchar',
        'length' => 1000,
        'not null' => TRUE,
        'default' => '',
      ],
      // @todo need to change 'type' as older mysql versions can't handle the
      // length.
      'url_part' => [
        'description' => 'The partial url path.',
        'type' => 'varchar',
        'length' => 1000,
        'not null' => TRUE,
        'default' => '',
      ],
      'ip_address' => [
        'description' => 'The ip address of the client.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ],
      'event' => [
        'description' => 'The webhook event type.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ],
      'data' => [
        'description' => 'The content (POST) of the webhook call.',
        'type' => 'blob',
        'not null' => TRUE,
        'size' => 'big',
        'serialize' => TRUE,
      ],
      'realm' => [
        'description' => 'The environment, or realm, for this Zoom / Drupal user relationship.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ],
      'created' => [
        'description' => 'The Unix timestamp when this record was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'id',
    ],
    'indexes' => [
      'event' => [
        'event',
      ],
      'realm' => [
        'realm',
      ],
      'created' => [
        'created',
      ],
    ],
  ];
  $schema['zoomapi_recordings_download_tracker'] = [
    'description' => 'Track meeting recordings to be downloaded.',
    'fields' => [
      'meeting_uuid' => [
        'description' => 'The Zoom meeting UUID.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ],
      'meeting_id' => [
        'description' => 'The Zoom provided meeting ID.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ],
      'destination_type' => [
        'description' => 'Define download destination as path or entity field.',
        'type' => 'varchar',
        'length' => 20,
        'not null' => TRUE,
        'default' => '',
      ],
      // @todo need to change 'type' as older mysql versions can't handle the
      // length.
      'destination' => [
        'description' => 'The path/uri or entity field information.',
        'type' => 'varchar',
        'length' => 1000,
        'not null' => TRUE,
        'default' => '',
      ],
      'success' => [
        'description' => 'Boolean indicator of successful download.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
      'attempts' => [
        'description' => 'Number of attempted downloads to allow for retries.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
      'data' => [
        'description' => 'The meeting recording data.',
        'type' => 'blob',
        'not null' => TRUE,
        'size' => 'big',
        'serialize' => TRUE,
      ],
      'realm' => [
        'description' => 'The environment, or realm, for this Zoom / Drupal user relationship.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ],
      'created' => [
        'description' => 'The Unix timestamp when this record was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
      'changed' => [
        'description' => 'The Unix timestamp when this record was last changed.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'meeting_uuid',
    ],
    'indexes' => [
      'realm' => [
        'realm',
      ],
      'success' => [
        'success',
      ],
      'attempts' => [
        'attempts',
      ],
      'created' => [
        'created',
      ],
    ],
  ];
  return $schema;
}