You are here

restrict_ip.install in Restrict IP 8

Same filename and directory in other branches
  1. 8.2 restrict_ip.install
  2. 7.2 restrict_ip.install
  3. 3.x restrict_ip.install

Contains the database schema used by the restrict IP module

File

restrict_ip.install
View source
<?php

/**
 * @file
 *   Contains the database schema used by the restrict IP module
 */
function restrict_ip_schema() {
  $schema['restrict_ip_whitelisted_ip_addresses'] = [
    'description' => 'Stores IP addresses whitelisted in the Restrict IP module',
    'fields' => [
      'ip_address' => [
        'description' => 'A Whitelisted IP address',
        'type' => 'varchar',
        'length' => 255,
      ],
    ],
    'indexes' => [
      'ip_address' => [
        'ip_address',
      ],
    ],
  ];
  $schema['restrict_ip_paths'] = [
    'description' => 'Stores white and black listed paths for the Restrict IP module',
    'fields' => [
      'type' => [
        'description' => 'The type of the listing, either black or white',
        'type' => 'varchar',
        'length' => 5,
      ],
      'path' => [
        'description' => 'The path to be white/blacklisted',
        'type' => 'varchar',
        'length' => 255,
      ],
    ],
    'indexes' => [
      'type-path' => [
        'type',
        'path',
      ],
    ],
  ];
  return $schema;
}
function restrict_ip_update_8001() {
  \Drupal::database()
    ->schema()
    ->createTable('restrict_ip_whitelisted_ip_addresses', [
    'description' => 'Stores IP addresses whitelisted in the Restrict IP module',
    'fields' => [
      'ip_address' => [
        'description' => 'A Whitelisted IP address',
        'type' => 'varchar',
        'length' => 255,
      ],
    ],
    'indexes' => [
      'ip_address' => [
        'ip_address',
      ],
    ],
  ]);
  \Drupal::database()
    ->schema()
    ->createTable('restrict_ip_paths', [
    'description' => 'Stores white and black listed paths for the Restrict IP module',
    'fields' => [
      'type' => [
        'description' => 'The type of the listing, either black or white',
        'type' => 'varchar',
        'length' => 5,
      ],
      'path' => [
        'description' => 'The path to be white/blacklisted',
        'type' => 'varchar',
        'length' => 255,
      ],
    ],
    'indexes' => [
      'type-path' => [
        'type',
        'path',
      ],
    ],
  ]);
}

Functions

Namesort descending Description
restrict_ip_schema @file Contains the database schema used by the restrict IP module
restrict_ip_update_8001