SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';


-- -----------------------------------------------------
-- Table UpiCallback
-- -----------------------------------------------------
DROP TABLE IF EXISTS UpiCallback;

CREATE TABLE UpiCallback (
    id INT UNSIGNED NOT NULL AUTO_INCREMENT,
    bank_abbr ENUM('AXIS','RBL') NOT NULL,
    type ENUM('Credit Notification','Credit Confirmation') NOT NULL,
    callback_data LONGBLOB,
    posting_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    is_processed TINYINT(1) DEFAULT 0,
    PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE UNIQUE INDEX upicallback_data_idx ON UpiCallback(callback_data(2000));


-- -----------------------------------------------------
-- Table UpiShortUrl
-- -----------------------------------------------------
DROP TABLE IF EXISTS UpiShortUrl;

CREATE TABLE UpiShortUrl (
  id int(11) NOT NULL AUTO_INCREMENT,
  long_url varchar(255) NOT NULL,
  short_code varchar(25) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  counter tinyint(4) NOT NULL DEFAULT '0',
  posting_time datetime NOT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB CHARSET=utf8;
CREATE UNIQUE INDEX upishorturl_short_code_idx ON UpiShortUrl(short_code);


SET @@UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
SET @@FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET @@SQL_MODE=@OLD_SQL_MODE;