set IGNORECASE TRUE;
DROP TABLE msg_metadata IF EXISTS;
CREATE TABLE msg_metadata ( 
  ID INTEGER default 0 NOT NULL AUTO_INCREMENT,
  MSG_ID LONGVARCHAR NOT NULL,
  MDN_ID LONGVARCHAR,
  DIRECTION VARCHAR(25) ,
  IS_RESEND VARCHAR(1) DEFAULT 'N',
  RESEND_COUNT INTEGER DEFAULT 0,
  SENDER_ID VARCHAR(255) NOT NULL,
  RECEIVER_ID VARCHAR(255) NOT NULL,
  STATUS VARCHAR(255),
  STATE VARCHAR(255),
  SIGNATURE_ALGORITHM VARCHAR(255),
  ENCRYPTION_ALGORITHM VARCHAR(255),
  COMPRESSION VARCHAR(255),
  FILE_NAME VARCHAR(255),
  CONTENT_TYPE VARCHAR(255),
  CONTENT_TRANSFER_ENCODING VARCHAR(255),
  MDN_MODE VARCHAR(255),
  MDN_RESPONSE LONGVARCHAR,
  STATE_MSG LONGVARCHAR,
  CREATE_DT TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  UPDATE_DT TIMESTAMP,
  
  PRIMARY KEY (ID) );

ALTER TABLE msg_metadata ADD CONSTRAINT MSG_ID_UNIQUE UNIQUE (MSG_ID);

