use provisioning;

CREATE INDEX v_fj_sid_idx on voip_fax_journal(sid);

CREATE TABLE `voip_fax_data` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `subscriber_id` int(10) unsigned NOT NULL,
  `sid` varchar(255) NOT NULL,
  `size` int(11) unsigned NOT NULL,
  `checksum` char(32) NOT NULL,
  `data` mediumblob NOT NULL,
  PRIMARY KEY (`id`),
  KEY `v_fd_sid_ref` (`sid`),
  KEY `v_fd_subid_idx` (`subscriber_id`),
  CONSTRAINT `v_fd_sid_ref` FOREIGN KEY (`sid`) REFERENCES `voip_fax_journal` (`sid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB CHARSET=utf8;

