You are here

function restrict_ip_update_8001 in Restrict IP 8

Same name and namespace in other branches
  1. 8.2 restrict_ip.install \restrict_ip_update_8001()
  2. 3.x restrict_ip.install \restrict_ip_update_8001()

File

./restrict_ip.install, line 45
Contains the database schema used by the restrict IP module

Code

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',
      ],
    ],
  ]);
}