<commit_before>CREATE DATABASE IF NOT EXISTS cockpit CHARACTER SET 'UTF8';

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 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  update_time TIMESTAMP 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 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  update_time TIMESTAMP 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,
  status_id INT NOT NULL DEFAULT 1 REFERENCES status_lu(id) ON DELETE RESTRICT ,
  create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  update_time TIMESTAMP NOT NULL DEFAULT 0
) ENGINE = INNODB;


CREATE TABLE IF NOT EXISTS consumer_group (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  cluster_name VARCHAR(255) NOT NULL DEFAULT 'DefaultCluster',
  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,
  status_id INT NOT NULL DEFAULT 1 REFERENCES status_lu(id) ON DELETE RESTRICT ,
  create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  update_time TIMESTAMP NOT NULL DEFAULT 0
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS status_lu (<commit_msg>fix : when we create consumer group we need add threshold for diff .<commit_after>CREATE DATABASE IF NOT EXISTS cockpit CHARACTER SET 'UTF8';

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 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  update_time TIMESTAMP 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 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  update_time TIMESTAMP 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,
  status_id INT NOT NULL DEFAULT 1 REFERENCES status_lu(id) ON DELETE RESTRICT ,
  create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  update_time TIMESTAMP NOT NULL DEFAULT 0
) ENGINE = INNODB;


CREATE TABLE IF NOT EXISTS consumer_group (
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  cluster_name VARCHAR(255) NOT NULL DEFAULT 'DefaultCluster',
  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,
  status_id INT NOT NULL DEFAULT 1 REFERENCES status_lu(id) ON DELETE RESTRICT ,
  threshold INT NOT NULL DEFAULT 1000,
  create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  update_time TIMESTAMP NOT NULL DEFAULT 0
) ENGINE = INNODB;

CREATE TABLE IF NOT EXISTS status_lu (
{'fraction_non_alphanumeric': 0.039430704619692024, 'fraction_numerical': 0.02006532897806813, 'mean_word_length': 4.8010825439783495, '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': '2354399', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1331, 'n_words': 540}