function pwa_webpush_schema in Progressive Web App 7.2
Implements hook_schema()
Return value
array
File
- modules/
pwa_webpush/ pwa_webpush.install, line 109
Code
function pwa_webpush_schema() {
$schema = [];
$schema['pwa_webpush_subscription'] = [
'description' => 'Stores browser push notification subscriptions',
'fields' => [
'sid' => [
'type' => 'serial',
'not null' => TRUE,
'unsigned' => TRUE,
'description' => 'Primary Key: Unique subscription ID.',
],
'uid' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => "User's {users}.uid.",
],
'created' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The Unix timestamp when the subscription was created.',
],
'last_used' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The Unix timestamp when the subscription was last used successfully.',
],
'expired' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The Unix timestamp when the subscription expired.',
],
'endpoint_sha256' => [
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'description' => 'sha256 of the enpoint URL',
],
'json' => [
'type' => 'text',
'size' => 'normal',
'not null' => TRUE,
'description' => 'JSON serialization of the subscription sent by the browser',
],
],
'unique keys' => [
'keys' => [
'endpoint_sha256',
],
],
'primary key' => [
'sid',
],
'foreign keys' => [
'user' => [
'table' => 'users',
'columns' => [
'uid' => 'uid',
],
],
],
'indexes' => [
'current_status' => [
'uid',
'expired',
'created',
'last_used',
],
],
];
return $schema;
}