<commit_before>USE cockpit;

CREATE TABLE IF NOT EXISTS name_server (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  ip VARCHAR(64) NOT NULL,
  port SMALLINT NOT NULL DEFAULT 9876,
  create_time BIGINT NOT NULL DEFAULT 0,
  update_time BIGINT NOT NULL DEFAULT 0
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS ip_mapping(
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  inner_ip VARCHAR(64) NOT NULL,
  public_ip VARCHAR(64) NOT NULL,
  create_time BIGINT NOT NULL DEFAULT 0,
  update_time BIGINT NOT NULL DEFAULT 0
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS topic (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  topic VARCHAR(255) NOT NULL,
  cluster_name VARCHAR(100) NOT NULL DEFAULT 'DefaultCluster',
  permission TINYINT NOT NULL DEFAULT 6,
  write_queue_num INT NOT NULL DEFAULT 4,
  read_queue_num INT NOT NULL DEFAULT 4,
  unit BOOL NOT NULL DEFAULT FALSE ,
  has_unit_subscription BOOL NOT NULL DEFAULT FALSE ,
  broker_address VARCHAR(255),
  order_type BOOL DEFAULT FALSE,
  allow BOOL DEFAULT FALSE,
  create_time BIGINT NOT NULL DEFAULT 0,
  update_time BIGINT NOT NULL DEFAULT 0
) ENGINE = INNODB;


CREATE TABLE IF NOT EXISTS consumer_group (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  which_broker_when_consume_slowly INT NOT NULL DEFAULT 1,
  group_name VARCHAR(255) NOT NULL,
  consume_enable BOOL NOT NULL DEFAULT TRUE ,
  consume_broadcast_enable BOOL NOT NULL DEFAULT FALSE ,
  broker_address VARCHAR(255),
  broker_id INT,
  retry_max_times INT NOT NULL DEFAULT 3,
  retry_queue_num MEDIUMINT NOT NULL DEFAULT 3,
  consume_from_min_enable BOOL NOT NULL DEFAULT TRUE,
  create_time DATETIME NOT NULL DEFAULT 0,
  update_time DATETIME NOT NULL DEFAULT 0
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS cockpit_user (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  role VARCHAR(32) NOT NULL,
  username VARCHAR(32) NOT NULL ,
  password  VARCHAR(64) NOT NULL
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS cockpit_role (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  name VARCHAR(32) NOT NULL
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS cockpit_rel_user_role (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  user_id INT NOT NULL,
  role_id INT NOT NULL
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS cockpit_user_login (
  user_name VARCHAR(32) NOT NULL ,
  login_status INT NOT NULL DEFAULT 1,
  retry INT NOT NULL DEFAULT 0,
  lock_time BIGINT NOT NULL DEFAULT 0
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS cockpit_message_backlog (
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    topic VARCHAR(255) NOT NULL,
    broker_name VARCHAR(255) NOT NULL,
    queue_id INT NOT NULL,
    broker_offset BIGINT NOT NULL DEFAULT 0,
    consumer_offset BIGINT NOT NULL DEFAULT 0,
    last_timestamp BIGINT NOT NULL DEFAULT 0,
    diff BIGINT NOT NULL DEFAULT 0,
    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE = INNODB;<commit_msg>Add name_server_kv table to mange custom KV for name servers.<commit_after>USE cockpit;

CREATE TABLE IF NOT EXISTS name_server (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  ip VARCHAR(64) NOT NULL,
  port SMALLINT NOT NULL DEFAULT 9876,
  create_time BIGINT NOT NULL DEFAULT 0,
  update_time BIGINT NOT NULL DEFAULT 0
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS ip_mapping(
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  inner_ip VARCHAR(64) NOT NULL,
  public_ip VARCHAR(64) NOT NULL,
  create_time BIGINT NOT NULL DEFAULT 0,
  update_time BIGINT NOT NULL DEFAULT 0
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS topic (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  topic VARCHAR(255) NOT NULL,
  cluster_name VARCHAR(100) NOT NULL DEFAULT 'DefaultCluster',
  permission TINYINT NOT NULL DEFAULT 6,
  write_queue_num INT NOT NULL DEFAULT 4,
  read_queue_num INT NOT NULL DEFAULT 4,
  unit BOOL NOT NULL DEFAULT FALSE ,
  has_unit_subscription BOOL NOT NULL DEFAULT FALSE ,
  broker_address VARCHAR(255),
  order_type BOOL DEFAULT FALSE,
  allow BOOL DEFAULT FALSE,
  create_time BIGINT NOT NULL DEFAULT 0,
  update_time BIGINT NOT NULL DEFAULT 0
) ENGINE = INNODB;


CREATE TABLE IF NOT EXISTS consumer_group (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  which_broker_when_consume_slowly INT NOT NULL DEFAULT 1,
  group_name VARCHAR(255) NOT NULL,
  consume_enable BOOL NOT NULL DEFAULT TRUE ,
  consume_broadcast_enable BOOL NOT NULL DEFAULT FALSE ,
  broker_address VARCHAR(255),
  broker_id INT,
  retry_max_times INT NOT NULL DEFAULT 3,
  retry_queue_num MEDIUMINT NOT NULL DEFAULT 3,
  consume_from_min_enable BOOL NOT NULL DEFAULT TRUE,
  create_time DATETIME NOT NULL DEFAULT 0,
  update_time DATETIME NOT NULL DEFAULT 0
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS cockpit_user (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  role VARCHAR(32) NOT NULL,
  username VARCHAR(32) NOT NULL ,
  password  VARCHAR(64) NOT NULL
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS cockpit_role (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  name VARCHAR(32) NOT NULL
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS cockpit_rel_user_role (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  user_id INT NOT NULL,
  role_id INT NOT NULL
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS cockpit_user_login (
  user_name VARCHAR(32) NOT NULL ,
  login_status INT NOT NULL DEFAULT 1,
  retry INT NOT NULL DEFAULT 0,
  lock_time BIGINT NOT NULL DEFAULT 0
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS cockpit_message_backlog (
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    topic VARCHAR(255) NOT NULL,
    broker_name VARCHAR(255) NOT NULL,
    queue_id INT NOT NULL,
    broker_offset BIGINT NOT NULL DEFAULT 0,
    consumer_offset BIGINT NOT NULL DEFAULT 0,
    last_timestamp BIGINT NOT NULL DEFAULT 0,
    diff BIGINT NOT NULL DEFAULT 0,
    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE = INNODB;

CREATE TABLE name_server_kv (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  name_space VARCHAR(255) NOT NULL,
  `key` VARCHAR(255) NOT NULL,
  `value` VARCHAR(255) NOT NULL
);
{'fraction_non_alphanumeric': 0.042840473412235375, 'fraction_numerical': 0.022170361726954493, 'mean_word_length': 4.2264808362369335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1356597', 'n_tokens_mistral': 2133, 'n_tokens_neox': 1911, 'n_words': 786}