Adding tables to the database

 

Having created a user and the user's database, we will now add all the needed tables.

  1. Select isltest database in the left side of the page, then click the SQL tab.
  2. Paste the text below into the provided space and then click Go.
CREATE TABLE session_event_to_status (
 status_code varchar(50) COLLATE utf8_unicode_ci NOT NULL,
 event_type_code varchar(50) COLLATE utf8_unicode_ci NOT NULL,
 new_status_code varchar(50) COLLATE utf8_unicode_ci NULL,
 warning bit NOT NULL
)
  1. Clear the text in the query space, paste all these lines and then click Go.
INSERT INTO session_event_to_status VALUES ('CANCELED', 'CODE', 'CANCELED', 0);
INSERT INTO session_event_to_status VALUES ('CANCELED', 'GETCODE', 'CANCELED', 0);
INSERT INTO session_event_to_status VALUES ('CANCELED', 'INVALID', 'CANCELED', 0);
INSERT INTO session_event_to_status VALUES ('CANCELED', 'MESSAGE', 'CANCELED', 0);
INSERT INTO session_event_to_status VALUES ('CANCELED', 'NEWSESSION', 'CANCELED', 0);
INSERT INTO session_event_to_status VALUES ('CANCELED', 'RECONNECT', 'CANCELED', 0);
INSERT INTO session_event_to_status VALUES ('CANCELED', 'START', 'CANCELED', 1);
INSERT INTO session_event_to_status VALUES ('CANCELED', 'STOP', 'CANCELED', 0);
INSERT INTO session_event_to_status VALUES ('CANCELED', 'TERMINATED', 'CANCELED', 1);
INSERT INTO session_event_to_status VALUES ('EMPTY', 'CODE', 'NEW', 0);
INSERT INTO session_event_to_status VALUES ('EMPTY', 'GETCODE', 'NEW', 0);
INSERT INTO session_event_to_status VALUES ('EMPTY', 'INVALID', 'CANCELED', 0);
INSERT INTO session_event_to_status VALUES ('EMPTY', 'MESSAGE', 'EMPTY', 0);
INSERT INTO session_event_to_status VALUES ('EMPTY', 'NEWSESSION', 'NEW', 0);
INSERT INTO session_event_to_status VALUES ('EMPTY', 'RECONNECT', 'RECONNECTED', 0);
INSERT INTO session_event_to_status VALUES ('EMPTY', 'START', 'RUNNING', 0);
INSERT INTO session_event_to_status VALUES ('EMPTY', 'STOP', 'FINISHED', 0);
INSERT INTO session_event_to_status VALUES ('EMPTY', 'TERMINATED', 'FINISHED', 1);
INSERT INTO session_event_to_status VALUES ('FINISHED', 'CODE', 'FINISHED', 0);
INSERT INTO session_event_to_status VALUES ('FINISHED', 'GETCODE', 'FINISHED', 0);
INSERT INTO session_event_to_status VALUES ('FINISHED', 'INVALID', 'FINISHED', 0);
INSERT INTO session_event_to_status VALUES ('FINISHED', 'MESSAGE', 'FINISHED', 0);
INSERT INTO session_event_to_status VALUES ('FINISHED', 'NEWSESSION', 'FINISHED', 0);
INSERT INTO session_event_to_status VALUES ('FINISHED', 'RECONNECT', 'RECONNECTED', 0);
INSERT INTO session_event_to_status VALUES ('FINISHED', 'START', 'FINISHED', 0);
INSERT INTO session_event_to_status VALUES ('FINISHED', 'STOP', 'FINISHED', 0);
INSERT INTO session_event_to_status VALUES ('FINISHED', 'TERMINATED', 'FINISHED', 1);
INSERT INTO session_event_to_status VALUES ('NEW', 'CODE', 'NEW', 0);
INSERT INTO session_event_to_status VALUES ('NEW', 'GETCODE', 'NEW', 0);
INSERT INTO session_event_to_status VALUES ('NEW', 'INVALID', 'CANCELED', 0);
INSERT INTO session_event_to_status VALUES ('NEW', 'MESSAGE', 'NEW', 0);
INSERT INTO session_event_to_status VALUES ('NEW', 'NEWSESSION', 'NEW', 1);
INSERT INTO session_event_to_status VALUES ('NEW', 'RECONNECT', 'RUNNING', 1);
INSERT INTO session_event_to_status VALUES ('NEW', 'START', 'RUNNING', 0);
INSERT INTO session_event_to_status VALUES ('NEW', 'STOP', 'FINISHED', 0);
INSERT INTO session_event_to_status VALUES ('NEW', 'TERMINATED', 'FINISHED', 1);
INSERT INTO session_event_to_status VALUES ('RECONNECTED', 'CODE', 'RECONNECTED', 0);
INSERT INTO session_event_to_status VALUES ('RECONNECTED', 'GETCODE', 'RECONNECTED', 0);
INSERT INTO session_event_to_status VALUES ('RECONNECTED', 'INVALID', 'RECONNECTED', 0);
INSERT INTO session_event_to_status VALUES ('RECONNECTED', 'MESSAGE', 'RECONNECTED', 0);
INSERT INTO session_event_to_status VALUES ('RECONNECTED', 'NEWSESSION', 'RECONNECTED', 0);
INSERT INTO session_event_to_status VALUES ('RECONNECTED', 'RECONNECT', 'RECONNECTED', 0);
INSERT INTO session_event_to_status VALUES ('RECONNECTED', 'START', 'RECONNECTED', 0);
INSERT INTO session_event_to_status VALUES ('RECONNECTED', 'STOP', 'FINISHED', 0);
INSERT INTO session_event_to_status VALUES ('RECONNECTED', 'TERMINATED', 'FINISHED', 0);
INSERT INTO session_event_to_status VALUES ('RUNNING', 'CODE', 'RUNNING', 0);
INSERT INTO session_event_to_status VALUES ('RUNNING', 'GETCODE', 'RUNNING', 0);
INSERT INTO session_event_to_status VALUES ('RUNNING', 'INVALID', 'RUNNING', 0);
INSERT INTO session_event_to_status VALUES ('RUNNING', 'MESSAGE', 'RUNNING', 0);
INSERT INTO session_event_to_status VALUES ('RUNNING', 'NEWSESSION', 'RUNNING', 0);
INSERT INTO session_event_to_status VALUES ('RUNNING', 'RECONNECT', 'RUNNING', 0);
INSERT INTO session_event_to_status VALUES ('RUNNING', 'START', 'RUNNING', 1);
INSERT INTO session_event_to_status VALUES ('RUNNING', 'STOP', 'FINISHED', 0);
INSERT INTO session_event_to_status VALUES ('RUNNING', 'TERMINATED', 'FINISHED', 1);
  1. Paste the text below into the provided space and click Go.
CREATE TABLE light_sessions (
 id bigint NOT NULL AUTO_INCREMENT PRIMARY KEY,
 total_connection_time int NULL,
 total_transferred_bytes bigint NULL,
 last_transferred_packet_time int NULL,
 desk_ip varchar(50) COLLATE utf8_unicode_ci NULL,
 client_ip varchar(50) COLLATE utf8_unicode_ci NULL,
 desk_version varchar(50) COLLATE utf8_unicode_ci NULL,
 client_version varchar(50) COLLATE utf8_unicode_ci NULL,
 cpg_server_id int NOT NULL,
 cpg_session_db_id varchar(50) COLLATE utf8_unicode_ci NULL,
 cpg_user_domain_name nvarchar(100) COLLATE utf8_unicode_ci NULL,
 cpg_user_name nvarchar(50) COLLATE utf8_unicode_ci NULL,
 start_time varchar(50) COLLATE utf8_unicode_ci NULL,
 stop_time varchar(50) COLLATE utf8_unicode_ci NULL,
 cpg_session_ident varchar(50) COLLATE utf8_unicode_ci NULL,
 custom_01 varchar(50) COLLATE utf8_unicode_ci NULL,
 custom_02 varchar(50) COLLATE utf8_unicode_ci NULL,
 custom_03 varchar(50) COLLATE utf8_unicode_ci NULL,
 status_code varchar(50) COLLATE utf8_unicode_ci NOT NULL,
 session_code varchar(50) COLLATE utf8_unicode_ci NULL,
 created_date varchar(50) COLLATE utf8_unicode_ci NULL,
 max_last_transferred_packet_time int NULL,
 max_total_transferred_bytes bigint NULL
)
  1. Clear the text in the query space, paste the text below into the provided space and click Go.
CREATE TABLE sessions_events (
 id bigint NOT NULL AUTO_INCREMENT PRIMARY KEY,
 cpg_session_ident varchar(50) COLLATE utf8_unicode_ci NOT NULL,
 event_type_code varchar(50) COLLATE utf8_unicode_ci NOT NULL,
 fields nvarchar(4000) COLLATE utf8_unicode_ci NULL,
 inserted_date varchar(50) COLLATE utf8_unicode_ci NOT NULL,
 event_date varchar(50) COLLATE utf8_unicode_ci NULL
)
  1. Clear the text in the query space, paste the text below into the provided space and click Go.
CREATE TABLE sessions_rawdata (
 id bigint NOT NULL AUTO_INCREMENT PRIMARY KEY,
 cpg_session_ident varchar(50) COLLATE utf8_unicode_ci NOT NULL,
 event_name varchar(50) COLLATE utf8_unicode_ci NULL,
 key_name varchar(5000) COLLATE utf8_unicode_ci NULL,
 key_value nvarchar(4000) COLLATE utf8_unicode_ci NULL
)

You have now prepared the tables. Please proceed to the next section: Adding scripts.

Was this article helpful?