-- ----------------------------
-- Table structure for SERVICES - 虚拟主机
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2021-02-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS NA_SERVICES (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "TITLE" VARCHAR(50) NOT NULL,
    "DOMAIN" VARCHAR(50) NOT NULL,
    "TYPE" VARCHAR(20) NOT NULL,
    "PORT" MEDIUMINT NOT NULL,
    "VALID" BOOLEAN,
    "FILTER" BOOLEAN NOT NULL,
    "FILTER_CONF" VARCHAR(500),
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);

-- ----------------------------
-- Table structure for LOCATIONS - 路径配置
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2021-02-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS NA_LOCATIONS (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "SERVICES_ID" BIGINT NOT NULL,
    "LOCAL_TITLE" VARCHAR(50) NOT NULL,
    "LOCAL_NOTE" VARCHAR(250),
    "LOCAL_PATH" VARCHAR(50) NOT NULL,
    "LOCAL_VALID" BOOLEAN NOT NULL,
    "FILTER" BOOLEAN NOT NULL,
    "FILTER_CONF" VARCHAR(500),
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);

-- ----------------------------
-- Table structure for CONFIG_DATA - 配置数据
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2021-02-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS NA_CONFIG_DATA (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "TARGET_ID" BIGINT NOT NULL,
    "RULE_ID" BIGINT,
    "CONF_NAME" VARCHAR(100) NOT NULL,
    "CONF_VALUE" VARCHAR(100) NOT NULL,
    "CONF_NOTE" VARCHAR(250),
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);

-- ----------------------------
-- Table structure for RULES - 配置规则
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2021-02-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS NA_RULES (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "RULE_FOR" VARCHAR(20) NOT NULL,
    "RULE_TYPE" VARCHAR(50) NOT NULL,
    "RULE_TITLE" VARCHAR(100) NOT NULL,
    "RULE_NAME" VARCHAR(100) NOT NULL,
    "RULE_VALUE" VARCHAR(100) NOT NULL,
    "VALUE_DEFAULT" VARCHAR(100) NOT NULL,
    "VALUE_REGEX" VARCHAR(100) NOT NULL,
    "VALUE_MAX" MEDIUMINT NOT NULL,
    "RULE_NOTE" VARCHAR(500),
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);

