| 107 | At present moment I'm working with MySQL database. |
| 108 | |
| 109 | === MySQL === |
| 110 | |
| 111 | {{{ |
| 112 | DROP TABLE IF EXISTS `protocols`; |
| 113 | CREATE TABLE `protocols` ( |
| 114 | `id` int NOT NULL auto_increment, |
| 115 | `name` VARCHAR(255) NOT NULL, |
| 116 | PRIMARY KEY (`id`) |
| 117 | ) ENGINE=MyISAM DEFAULT CHARSET=UTF8; |
| 118 | |
| 119 | DROP TABLE IF EXISTS `accounts`; |
| 120 | CREATE TABLE `accounts` ( |
| 121 | `id` int NOT NULL auto_increment, |
| 122 | `name` VARCHAR(255) NOT NULL, |
| 123 | `protocolId` int NOT NULL REFERENCES protocols(`id`), |
| 124 | PRIMARY KEY (`id`) |
| 125 | ) ENGINE=MyISAM DEFAULT CHARSET=UTF8; |
| 126 | |
| 127 | DROP TABLE IF EXISTS `buddies`; |
| 128 | CREATE TABLE `buddies` ( |
| 129 | `id` int NOT NULL auto_increment, |
| 130 | `name` VARCHAR(255) NOT NULL, |
| 131 | `type` int, |
| 132 | `accountId` int NOT NULL REFERENCES accounts(`id`), |
| 133 | PRIMARY KEY (`id`) |
| 134 | ) ENGINE=MyISAM DEFAULT CHARSET=UTF8; |
| 135 | |
| 136 | DROP TABLE IF EXISTS `conversations`; |
| 137 | CREATE TABLE `conversations` ( |
| 138 | `id` int NOT NULL auto_increment, |
| 139 | `datetime` int, |
| 140 | `size` int, |
| 141 | `accountId` int NOT NULL REFERENCES accounts(`id`), |
| 142 | `buddyId` int NOT NULL REFERENCES buddies(`id`), |
| 143 | PRIMARY KEY (`id`) |
| 144 | ) ENGINE=MyISAM DEFAULT CHARSET=UTF8; |
| 145 | |
| 146 | DROP TABLE IF EXISTS `messages`; |
| 147 | CREATE TABLE `messages` ( |
| 148 | `id` int NOT NULL auto_increment, |
| 149 | `conversationId` int NOT NULL REFERENCES conversations(`id`), |
| 150 | `ownerName` VARCHAR(255) NOT NULL, |
| 151 | `datetime` int, |
| 152 | `text` LONGTEXT NOT NULL, |
| 153 | `flags` int, |
| 154 | PRIMARY KEY (`id`) |
| 155 | ) ENGINE=MyISAM DEFAULT CHARSET=UTF8; |
| 156 | |
| 157 | }}} |