-- Master schema

CREATE SCHEMA "threatmonitor";
SET SCHEMA "threatmonitor";
CREATE REMOTE TABLE wifi_ippacket (
	"guid"      CHAR(36)      NOT NULL,
	"recv_date" CHARACTER LARGE OBJECT,
	"ip_df"     VARCHAR(5),
	"ip_dst"    VARCHAR(15),
	"ip_hlen"   INTEGER       NOT NULL,
	"ip_id"     INTEGER       NOT NULL,
	"ip_len"    INTEGER       NOT NULL,
	"ip_mf"     VARCHAR(5),
	"ip_off"    INTEGER       NOT NULL,
	"ip_proto"  INTEGER       NOT NULL,
	"ip_src"    VARCHAR(15),
	"ip_sum"    CHAR(10),
	"ip_tos"    INTEGER       NOT NULL,
	"ip_ttl"    INTEGER       NOT NULL,
	"ip_ver"    INTEGER       NOT NULL,
	CONSTRAINT "ippacket_1_guid_pkey" PRIMARY KEY ("guid")
) ON 'mapi:monetdb://172.17.0.2:50000/threatmonitor';

CREATE REMOTE TABLE wifi_ippacket2 (
	"guid"      CHAR(36)      NOT NULL,
	"recv_date" CHARACTER LARGE OBJECT,
	"ip_df"     VARCHAR(5),
	"ip_dst"    VARCHAR(15),
	"ip_hlen"   INTEGER       NOT NULL,
	"ip_id"     INTEGER       NOT NULL,
	"ip_len"    INTEGER       NOT NULL,
	"ip_mf"     VARCHAR(5),
	"ip_off"    INTEGER       NOT NULL,
	"ip_proto"  INTEGER       NOT NULL,
	"ip_src"    VARCHAR(15),
	"ip_sum"    CHAR(10),
	"ip_tos"    INTEGER       NOT NULL,
	"ip_ttl"    INTEGER       NOT NULL,
	"ip_ver"    INTEGER       NOT NULL,
	CONSTRAINT "ippacket_2_guid_pkey" PRIMARY KEY ("guid")
) ON 'mapi:monetdb://172.17.0.3:50000/threatmonitor';

CREATE REMOTE TABLE wifi_ippacket3 (
	"guid"      CHAR(36)      NOT NULL,
	"recv_date" CHARACTER LARGE OBJECT,
	"ip_df"     VARCHAR(5),
	"ip_dst"    VARCHAR(15),
	"ip_hlen"   INTEGER       NOT NULL,
	"ip_id"     INTEGER       NOT NULL,
	"ip_len"    INTEGER       NOT NULL,
	"ip_mf"     VARCHAR(5),
	"ip_off"    INTEGER       NOT NULL,
	"ip_proto"  INTEGER       NOT NULL,
	"ip_src"    VARCHAR(15),
	"ip_sum"    CHAR(10),
	"ip_tos"    INTEGER       NOT NULL,
	"ip_ttl"    INTEGER       NOT NULL,
	"ip_ver"    INTEGER       NOT NULL,
	CONSTRAINT "ippacket_3_guid_pkey" PRIMARY KEY ("guid")
) ON 'mapi:monetdb://172.17.0.4:50000/threatmonitor';

CREATE REMOTE TABLE wifi_ippacket4 (
	"guid"      CHAR(36)      NOT NULL,
	"recv_date" CHARACTER LARGE OBJECT,
	"ip_df"     VARCHAR(5),
	"ip_dst"    VARCHAR(15),
	"ip_hlen"   INTEGER       NOT NULL,
	"ip_id"     INTEGER       NOT NULL,
	"ip_len"    INTEGER       NOT NULL,
	"ip_mf"     VARCHAR(5),
	"ip_off"    INTEGER       NOT NULL,
	"ip_proto"  INTEGER       NOT NULL,
	"ip_src"    VARCHAR(15),
	"ip_sum"    CHAR(10),
	"ip_tos"    INTEGER       NOT NULL,
	"ip_ttl"    INTEGER       NOT NULL,
	"ip_ver"    INTEGER       NOT NULL,
	CONSTRAINT "ippacket_4_guid_pkey" PRIMARY KEY ("guid")
) ON 'mapi:monetdb://172.17.0.5:50000/threatmonitor';


CREATE MERGE TABLE ippacket (
	"guid"      CHAR(36)      NOT NULL,
	"recv_date" CHARACTER LARGE OBJECT,
	"ip_df"     VARCHAR(5),
	"ip_dst"    VARCHAR(15),
	"ip_hlen"   INTEGER       NOT NULL,
	"ip_id"     INTEGER       NOT NULL,
	"ip_len"    INTEGER       NOT NULL,
	"ip_mf"     VARCHAR(5),
	"ip_off"    INTEGER       NOT NULL,
	"ip_proto"  INTEGER       NOT NULL,
	"ip_src"    VARCHAR(15),
	"ip_sum"    CHAR(10),
	"ip_tos"    INTEGER       NOT NULL,
	"ip_ttl"    INTEGER       NOT NULL,
	"ip_ver"    INTEGER       NOT NULL,
	CONSTRAINT "ippacket_merge_guid_pkey" PRIMARY KEY ("guid")
);

ALTER TABLE ippacket ADD TABLE wifi_ippacket;
ALTER TABLE ippacket ADD TABLE wifi_ippacket2;
ALTER TABLE ippacket ADD TABLE wifi_ippacket3;

-- Remote schema host mdb-repl-01

CREATE SCHEMA "threatmonitor";
SET SCHEMA "threatmonitor";
CREATE TABLE "threatmonitor"."wifi_ippacket" (
	"guid"      CHAR(36)      NOT NULL,
	"recv_date" CHARACTER LARGE OBJECT,
	"ip_df"     VARCHAR(5),
	"ip_dst"    VARCHAR(15),
	"ip_hlen"   INTEGER       NOT NULL,
	"ip_id"     INTEGER       NOT NULL,
	"ip_len"    INTEGER       NOT NULL,
	"ip_mf"     VARCHAR(5),
	"ip_off"    INTEGER       NOT NULL,
	"ip_proto"  INTEGER       NOT NULL,
	"ip_src"    VARCHAR(15),
	"ip_sum"    CHAR(10),
	"ip_tos"    INTEGER       NOT NULL,
	"ip_ttl"    INTEGER       NOT NULL,
	"ip_ver"    INTEGER       NOT NULL,
	CONSTRAINT "ippacket_1_guid_pkey" PRIMARY KEY ("guid")
);

-- Remote schema host mdb-repl-02

CREATE SCHEMA "threatmonitor";
SET SCHEMA "threatmonitor";
CREATE TABLE "threatmonitor"."wifi_ippacket2" (
	"guid"      CHAR(36)      NOT NULL,
	"recv_date" CHARACTER LARGE OBJECT,
	"ip_df"     VARCHAR(5),
	"ip_dst"    VARCHAR(15),
	"ip_hlen"   INTEGER,
	"ip_id"     INTEGER,
	"ip_len"    INTEGER,
	"ip_mf"     VARCHAR(5),
	"ip_off"    INTEGER,
	"ip_proto"  INTEGER,
	"ip_src"    VARCHAR(15),
	"ip_sum"    CHAR(10),
	"ip_tos"    INTEGER,
	"ip_ttl"    INTEGER,
	"ip_ver"    INTEGER,
	CONSTRAINT "ippacket_2_guid_pkey" PRIMARY KEY ("guid")
);

-- Remote schema host mdb-repl-03

CREATE SCHEMA "threatmonitor";
SET SCHEMA "threatmonitor";
CREATE TABLE "threatmonitor"."wifi_ippacket3" (
	"guid"      CHAR(36)      NOT NULL,
	"recv_date" CHARACTER LARGE OBJECT,
	"ip_df"     VARCHAR(5),
	"ip_dst"    VARCHAR(15),
	"ip_hlen"   INTEGER,
	"ip_id"     INTEGER,
	"ip_len"    INTEGER,
	"ip_mf"     VARCHAR(5),
	"ip_off"    INTEGER,
	"ip_proto"  INTEGER,
	"ip_src"    VARCHAR(15),
	"ip_sum"    CHAR(10),
	"ip_tos"    INTEGER,
	"ip_ttl"    INTEGER,
	"ip_ver"    INTEGER,
	CONSTRAINT "ippacket_3_guid_pkey" PRIMARY KEY ("guid")
);

-- Remote schema host mdb-repl-04

CREATE SCHEMA "threatmonitor";
SET SCHEMA "threatmonitor";
CREATE TABLE "threatmonitor"."wifi_ippacket4" (
	"guid"      CHAR(36)      NOT NULL,
	"recv_date" CHARACTER LARGE OBJECT,
	"ip_df"     VARCHAR(5),
	"ip_dst"    VARCHAR(15),
	"ip_hlen"   INTEGER,
	"ip_id"     INTEGER,
	"ip_len"    INTEGER,
	"ip_mf"     VARCHAR(5),
	"ip_off"    INTEGER,
	"ip_proto"  INTEGER,
	"ip_src"    VARCHAR(15),
	"ip_sum"    CHAR(10),
	"ip_tos"    INTEGER,
	"ip_ttl"    INTEGER,
	"ip_ver"    INTEGER,
	CONSTRAINT "ippacket_4_guid_pkey" PRIMARY KEY ("guid")
);



