You are here

function cleantalk_schema in Anti Spam by CleanTalk 9.1.x

Same name and namespace in other branches
  1. 8.4 cleantalk.install \cleantalk_schema()
  2. 8 cleantalk.install \cleantalk_schema()
  3. 8.3 cleantalk.install \cleantalk_schema()
  4. 7 cleantalk.install \cleantalk_schema()

Implements hook_schema().

File

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

Code

function cleantalk_schema() {
  $schema['cleantalk_timelabels'] = array(
    'description' => 'Timelabels for admin notification sending.',
    'fields' => array(
      'ct_key' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Notification ID.',
      ),
      'ct_value' => array(
        'type' => 'int',
        'length' => 12,
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Time of last notification.',
      ),
    ),
    'primary key' => array(
      'ct_key',
    ),
  );
  $schema['cleantalk_sfw'] = 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.',
      ),
      'source' => array(
        'type' => 'int',
        'length' => 1,
        'unsigned' => FALSE,
        'not null' => FALSE,
        'default' => NULL,
        'description' => 'Source.',
      ),
    ),
    'indexes' => array(
      'network' => array(
        'network',
        'mask',
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  $schema['cleantalk_sfw_logs'] = 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.',
      ),
      'status' => array(
        'type' => 'varchar',
        'length' => 50,
        'description' => 'status',
        'not null' => false,
        'default' => NULL,
      ),
      '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,
      ),
      'source' => array(
        'type' => 'int',
        'length' => 1,
        'not null' => FALSE,
        'default' => NULL,
      ),
      'network' => array(
        'type' => 'varchar',
        'length' => 20,
        'not null' => FALSE,
        'default' => NULL,
      ),
      'first_url' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
        'default' => NULL,
      ),
      'last_url' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => FALSE,
        'default' => NULL,
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  $schema['cleantalk_ac_logs'] = array(
    'description' => 'AntiCrawler logs.',
    'fields' => array(
      'id' => array(
        'type' => 'varchar',
        'length' => 40,
        'not null' => true,
        'description' => 'ID.',
      ),
      'ip' => array(
        'type' => 'varchar',
        'length' => 40,
        'not null' => TRUE,
        'description' => 'IP.',
      ),
      'ua' => array(
        'type' => 'varchar',
        'length' => 40,
        'not null' => TRUE,
        'description' => 'UA.',
      ),
      'entries' => array(
        'type' => 'int',
        'length' => 11,
        'description' => 'Entries.',
        'not null' => TRUE,
        'default' => 0,
      ),
      'interval_start' => array(
        'type' => 'int',
        'length' => 11,
        'not null' => TRUE,
        'description' => 'interval_start.',
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  $schema['cleantalk_ac_ua_bl'] = array(
    'description' => 'AntiCrawler User-Agent Blacklist.',
    'fields' => array(
      'id' => array(
        'type' => 'int',
        'length' => 11,
        'not null' => true,
        'description' => 'ID.',
      ),
      'ua_template' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'ua_status' => array(
        'type' => 'int',
        'length' => 1,
        'not null' => FALSE,
      ),
    ),
    'indexes' => array(
      'network' => array(
        'ua_template',
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  $schema['cleantalk_sessions'] = array(
    'description' => 'Alternative cookies table',
    'fields' => array(
      'id' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'description' => 'id.',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 40,
        'not null' => TRUE,
        'default' => '',
        'description' => 'name.',
      ),
      'value' => array(
        'type' => 'text',
        'not null' => FALSE,
        'default' => NULL,
        'description' => 'value.',
      ),
      'last_update' => array(
        'type' => 'datetime',
        'mysql_type' => 'datetime',
        'pgsql_type' => 'timestamp',
        'not null' => FALSE,
        'default' => NULL,
        'description' => 'time().',
      ),
    ),
    'primary key' => array(
      'id',
      'name',
    ),
  );
  return $schema;
}