smsq/data/mysql.init.sql

87 lines
2.3 KiB
SQL

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `smsq`
--
-- --------------------------------------------------------
--
-- Table structure for table `incoming_msg`
--
CREATE TABLE `incoming_msg` (
`datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`uuid` varchar(40) NOT NULL,
`number` text NOT NULL,
`text` text NOT NULL,
`timestampms` bigint(20) NOT NULL,
`status` varchar(20) NOT NULL DEFAULT 'pending',
`lastupdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`delivered_datetime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `outgoing_msg`
--
CREATE TABLE `outgoing_msg` (
`datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`uuid` varchar(40) NOT NULL,
`number` text NOT NULL,
`text` text NOT NULL,
`uniqueid` bigint(11) UNSIGNED NOT NULL,
`nbfrag` int(11) NOT NULL,
`status` varchar(30) NOT NULL DEFAULT 'pending',
`lastupdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`delivered_datetime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `outgoing_msg_frag`
--
CREATE TABLE `outgoing_msg_frag` (
`msguid` bigint(11) UNSIGNED NOT NULL,
`fragid` int(11) NOT NULL,
`status` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `incoming_msg`
--
ALTER TABLE `incoming_msg`
ADD PRIMARY KEY (`uuid`);
--
-- Indexes for table `outgoing_msg`
--
ALTER TABLE `outgoing_msg`
ADD PRIMARY KEY (`uuid`),
ADD UNIQUE KEY `uniqueid` (`uniqueid`);
--
-- Indexes for table `outgoing_msg_frag`
--
ALTER TABLE `outgoing_msg_frag`
ADD PRIMARY KEY (`fragid`,`msguid`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;