1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
|
--
-- Database for Gammu SMSD
--
-- In case you get errors about not supported charset, please
-- replace utf8mb4 with utf8.
-- --------------------------------------------------------
--
-- Table structure for table `gammu`
--
CREATE TABLE `gammu` (
`Version` integer NOT NULL default '0' PRIMARY KEY
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `gammu`
--
INSERT INTO `gammu` (`Version`) VALUES (17);
-- --------------------------------------------------------
--
-- Table structure for table `inbox`
--
CREATE TABLE `inbox` (
`UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`ReceivingDateTime` timestamp NOT NULL default '0000-00-00 00:00:00',
`Text` text NOT NULL,
`SenderNumber` varchar(20) NOT NULL default '',
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',
`UDH` text NOT NULL,
`SMSCNumber` varchar(20) NOT NULL default '',
`Class` integer NOT NULL default '-1',
`TextDecoded` text NOT NULL,
`ID` integer unsigned NOT NULL auto_increment,
`RecipientID` text NOT NULL,
`Processed` enum('false','true') NOT NULL default 'false',
`Status` integer NOT NULL default '-1',
PRIMARY KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `inbox`
--
-- --------------------------------------------------------
--
-- Table structure for table `outbox`
--
CREATE TABLE `outbox` (
`UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`InsertIntoDB` timestamp NOT NULL default '0000-00-00 00:00:00',
`SendingDateTime` timestamp NOT NULL default '0000-00-00 00:00:00',
`SendBefore` time NOT NULL DEFAULT '23:59:59',
`SendAfter` time NOT NULL DEFAULT '00:00:00',
`Text` text,
`DestinationNumber` varchar(20) NOT NULL default '',
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',
`UDH` text,
`Class` integer default '-1',
`TextDecoded` text NOT NULL,
`ID` integer unsigned NOT NULL auto_increment,
`MultiPart` enum('false','true') default 'false',
`RelativeValidity` integer default '-1',
`SenderID` varchar(255),
`SendingTimeOut` timestamp NULL default '0000-00-00 00:00:00',
`DeliveryReport` enum('default','yes','no') default 'default',
`CreatorID` text NOT NULL,
`Retries` int(3) default 0,
`Priority` integer default 0,
`Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error','Reserved') NOT NULL default 'Reserved',
`StatusCode` integer NOT NULL default '-1',
PRIMARY KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
CREATE INDEX outbox_date ON outbox(SendingDateTime, SendingTimeOut);
CREATE INDEX outbox_sender ON outbox(SenderID(250));
--
-- Dumping data for table `outbox`
--
-- --------------------------------------------------------
--
-- Table structure for table `outbox_multipart`
--
CREATE TABLE `outbox_multipart` (
`Text` text,
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',
`UDH` text,
`Class` integer default '-1',
`TextDecoded` text,
`ID` integer unsigned NOT NULL default '0',
`SequencePosition` integer NOT NULL default '1',
`Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error','Reserved') NOT NULL default 'Reserved',
`StatusCode` integer NOT NULL default '-1',
PRIMARY KEY (`ID`, `SequencePosition`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `outbox_multipart`
--
-- --------------------------------------------------------
--
-- Table structure for table `phones`
--
CREATE TABLE `phones` (
`ID` text NOT NULL,
`UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`InsertIntoDB` timestamp NOT NULL default '0000-00-00 00:00:00',
`TimeOut` timestamp NOT NULL default '0000-00-00 00:00:00',
`Send` enum('yes','no') NOT NULL default 'no',
`Receive` enum('yes','no') NOT NULL default 'no',
`IMEI` varchar(35) NOT NULL,
`IMSI` varchar(35) NOT NULL,
`NetCode` varchar(10) default 'ERROR',
`NetName` varchar(35) default 'ERROR',
`Client` text NOT NULL,
`Battery` integer NOT NULL DEFAULT -1,
`Signal` integer NOT NULL DEFAULT -1,
`Sent` int NOT NULL DEFAULT 0,
`Received` int NOT NULL DEFAULT 0,
PRIMARY KEY (`IMEI`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `phones`
--
-- --------------------------------------------------------
--
-- Table structure for table `sentitems`
--
CREATE TABLE `sentitems` (
`UpdatedInDB` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`InsertIntoDB` timestamp NOT NULL default '0000-00-00 00:00:00',
`SendingDateTime` timestamp NOT NULL default '0000-00-00 00:00:00',
`DeliveryDateTime` timestamp NULL,
`Text` text NOT NULL,
`DestinationNumber` varchar(20) NOT NULL default '',
`Coding` enum('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression') NOT NULL default 'Default_No_Compression',
`UDH` text NOT NULL,
`SMSCNumber` varchar(20) NOT NULL default '',
`Class` integer NOT NULL default '-1',
`TextDecoded` text NOT NULL,
`ID` integer unsigned NOT NULL default '0',
`SenderID` varchar(255) NOT NULL,
`SequencePosition` integer NOT NULL default '1',
`Status` enum('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending','DeliveryUnknown','Error') NOT NULL default 'SendingOK',
`StatusError` integer NOT NULL default '-1',
`TPMR` integer NOT NULL default '-1',
`RelativeValidity` integer NOT NULL default '-1',
`CreatorID` text NOT NULL,
`StatusCode` integer NOT NULL default '-1',
PRIMARY KEY (`ID`, `SequencePosition`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
CREATE INDEX sentitems_date ON sentitems(DeliveryDateTime);
CREATE INDEX sentitems_tpmr ON sentitems(TPMR);
CREATE INDEX sentitems_dest ON sentitems(DestinationNumber);
CREATE INDEX sentitems_sender ON sentitems(SenderID(250));
--
-- Dumping data for table `sentitems`
--
--
-- Triggers for setting default timestamps
--
DELIMITER //
CREATE TRIGGER inbox_timestamp BEFORE INSERT ON inbox
FOR EACH ROW
BEGIN
IF NEW.ReceivingDateTime = '0000-00-00 00:00:00' THEN
SET NEW.ReceivingDateTime = CURRENT_TIMESTAMP();
END IF;
END;//
CREATE TRIGGER outbox_timestamp BEFORE INSERT ON outbox
FOR EACH ROW
BEGIN
IF NEW.InsertIntoDB = '0000-00-00 00:00:00' THEN
SET NEW.InsertIntoDB = CURRENT_TIMESTAMP();
END IF;
IF NEW.SendingDateTime = '0000-00-00 00:00:00' THEN
SET NEW.SendingDateTime = CURRENT_TIMESTAMP();
END IF;
IF NEW.SendingTimeOut = '0000-00-00 00:00:00' THEN
SET NEW.SendingTimeOut = CURRENT_TIMESTAMP();
END IF;
END;//
CREATE TRIGGER phones_timestamp BEFORE INSERT ON phones
FOR EACH ROW
BEGIN
IF NEW.InsertIntoDB = '0000-00-00 00:00:00' THEN
SET NEW.InsertIntoDB = CURRENT_TIMESTAMP();
END IF;
IF NEW.TimeOut = '0000-00-00 00:00:00' THEN
SET NEW.TimeOut = CURRENT_TIMESTAMP();
END IF;
END;//
CREATE TRIGGER sentitems_timestamp BEFORE INSERT ON sentitems
FOR EACH ROW
BEGIN
IF NEW.InsertIntoDB = '0000-00-00 00:00:00' THEN
SET NEW.InsertIntoDB = CURRENT_TIMESTAMP();
END IF;
IF NEW.SendingDateTime = '0000-00-00 00:00:00' THEN
SET NEW.SendingDateTime = CURRENT_TIMESTAMP();
END IF;
END;//
DELIMITER ;
|