You are here

function cleantalk_update_8147 in Anti Spam by CleanTalk 8.4

File

./cleantalk.install, line 304
Install and uninstall functions, schema definition for the CleanTalk module.

Code

function cleantalk_update_8147(&$sandbox) {
  \Drupal::service('database')
    ->schema()
    ->dropTable('cleantalk_sfw');
  \Drupal::service('database')
    ->schema()
    ->dropTable('cleantalk_sfw_logs');
  $cleantalk_sfw_table = array(
    'description' => 'SpamFireWall data.',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'description' => "ID",
        'length' => 11,
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'network' => array(
        'type' => 'int',
        'length' => 11,
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Spam network.',
      ),
      'mask' => array(
        'type' => 'int',
        'length' => 11,
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Spam mask.',
      ),
      'status' => array(
        'type' => 'int',
        'length' => 1,
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Spam status.',
      ),
    ),
    'indexes' => array(
      'network' => array(
        'network',
        'mask',
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  $cleantalk_sfw_logs_table = array(
    'description' => 'SpamFireWall logs.',
    'fields' => array(
      'id' => array(
        'type' => 'varchar',
        'length' => 40,
        'not null' => true,
        'description' => 'ID.',
      ),
      'ip' => array(
        'type' => 'varchar',
        'length' => 15,
        'not null' => TRUE,
        'description' => 'IP.',
      ),
      'all_entries' => array(
        'type' => 'int',
        'description' => 'All entries.',
      ),
      'blocked_entries' => array(
        'type' => 'int',
        'description' => 'Blocked entries.',
      ),
      'entries_timestamp' => array(
        'type' => 'int',
        'description' => 'time().',
      ),
      'ua_id' => array(
        'type' => 'int',
        'description' => 'ua_id',
        'length' => 11,
        'not null' => FALSE,
        'default' => NULL,
        'unsigned' => true,
      ),
      'ua_name' => array(
        'type' => 'varchar',
        'description' => 'ua_name',
        'length' => 1024,
        'not null' => TRUE,
      ),
      'status' => array(
        'type' => 'varchar',
        'description' => 'status',
        'length' => 50,
        'not null' => false,
        'default' => NULL,
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  \Drupal::service('database')
    ->schema()
    ->createTable('cleantalk_sfw', $cleantalk_sfw_table);
  \Drupal::service('database')
    ->schema()
    ->createTable('cleantalk_sfw_logs', $cleantalk_sfw_logs_table);
}