| 1 | [ |
| 2 | { |
| 3 | "name": "echo_event", |
| 4 | "comment": "An event is a thing that happened that caused one or more users to be notified. For every notified user, there is a corresponding row in the echo_notification table.", |
| 5 | "columns": [ |
| 6 | { |
| 7 | "name": "event_id", |
| 8 | "comment": "Unique auto-increment ID", |
| 9 | "type": "integer", |
| 10 | "options": { "autoincrement": true, "notnull": true, "unsigned": true } |
| 11 | }, |
| 12 | { |
| 13 | "name": "event_type", |
| 14 | "comment": "Event type; one of the keys in $wgEchoNotifications", |
| 15 | "type": "binary", |
| 16 | "options": { "notnull": true, "length": 64 } |
| 17 | }, |
| 18 | { |
| 19 | "name": "event_variant", |
| 20 | "comment": "Unused, always null", |
| 21 | "type": "binary", |
| 22 | "options": { "notnull": false, "length": 64 } |
| 23 | }, |
| 24 | { |
| 25 | "name": "event_agent_id", |
| 26 | "comment": "The agent (user who triggered the event), if any. If the agent is a logged-in user, event_agent_id contains their user ID and event_agent_ip is null. If the agent is an anonymous user, event_agent_ip contains their IP address and event_agent_id is null. If the event doesn't have an agent, both fields are null.", |
| 27 | "type": "integer", |
| 28 | "options": { "notnull": false, "unsigned": true } |
| 29 | }, |
| 30 | { |
| 31 | "name": "event_agent_ip", |
| 32 | "comment": "The agent (user who triggered the event), if any. If the agent is a logged-in user, event_agent_id contains their user ID and event_agent_ip is null. If the agent is an anonymous user, event_agent_ip contains their IP address and event_agent_id is null. If the event doesn't have an agent, both fields are null.", |
| 33 | "type": "binary", |
| 34 | "options": { "notnull": false, "length": 39 } |
| 35 | }, |
| 36 | { |
| 37 | "name": "event_extra", |
| 38 | "comment": "JSON blob with additional information about the event", |
| 39 | "type": "blob", |
| 40 | "options": { "notnull": false, "length": 65530 } |
| 41 | }, |
| 42 | { |
| 43 | "name": "event_page_id", |
| 44 | "comment": "Page ID of the page the event happened on, if any (key to page_id)", |
| 45 | "type": "integer", |
| 46 | "options": { "notnull": false, "unsigned": true } |
| 47 | }, |
| 48 | { |
| 49 | "name": "event_deleted", |
| 50 | "comment": "Whether the event pertains to a deleted page and should be hidden. Events are marked as deleted when the related page is deleted, and unmarked as deleted when the related page is undeleted", |
| 51 | "type": "mwtinyint", |
| 52 | "options": { "notnull": true, "unsigned": true, "default": 0 } |
| 53 | } |
| 54 | ], |
| 55 | "indexes": [ |
| 56 | { |
| 57 | "name": "echo_event_type", |
| 58 | "comment": "Index to get only 'alert' types or only 'message' types", |
| 59 | "columns": [ "event_type" ], |
| 60 | "unique": false |
| 61 | }, |
| 62 | { |
| 63 | "name": "echo_event_page_id", |
| 64 | "comment": "Index to find events for a specific page", |
| 65 | "columns": [ "event_page_id" ], |
| 66 | "unique": false |
| 67 | } |
| 68 | ], |
| 69 | "pk": [ "event_id" ] |
| 70 | }, |
| 71 | { |
| 72 | "name": "echo_notification", |
| 73 | "comment": "A notification is a user being notified about a certain event. Multiple users can be notified about the same event.", |
| 74 | "columns": [ |
| 75 | { |
| 76 | "name": "notification_event", |
| 77 | "comment": "Key to event_id", |
| 78 | "type": "integer", |
| 79 | "options": { "notnull": true, "unsigned": true } |
| 80 | }, |
| 81 | { |
| 82 | "name": "notification_user", |
| 83 | "comment": "Key to user_id", |
| 84 | "type": "integer", |
| 85 | "options": { "notnull": true, "unsigned": true } |
| 86 | }, |
| 87 | { |
| 88 | "name": "notification_timestamp", |
| 89 | "comment": "Timestamp when the notification was created", |
| 90 | "type": "mwtimestamp", |
| 91 | "options": { "notnull": true } |
| 92 | }, |
| 93 | { |
| 94 | "name": "notification_read_timestamp", |
| 95 | "comment": "Timestamp when the user read the notification, or null if unread", |
| 96 | "type": "mwtimestamp", |
| 97 | "options": { "notnull": false } |
| 98 | }, |
| 99 | { |
| 100 | "name": "notification_bundle_hash", |
| 101 | "comment": "Hash for bundling together similar notifications. Notifications that can be bundled together will have the same hash", |
| 102 | "type": "binary", |
| 103 | "options": { "notnull": true, "length": 32 } |
| 104 | } |
| 105 | ], |
| 106 | "indexes": [ |
| 107 | { |
| 108 | "name": "echo_user_timestamp", |
| 109 | "comment": "Index to get a user's notifications in chronological order", |
| 110 | "columns": [ "notification_user", "notification_timestamp" ], |
| 111 | "unique": false |
| 112 | }, |
| 113 | { |
| 114 | "name": "echo_notification_event", |
| 115 | "comment": "Used to get all notifications for a given event", |
| 116 | "columns": [ "notification_event" ], |
| 117 | "unique": false |
| 118 | }, |
| 119 | { |
| 120 | "name": "echo_notification_user_read_timestamp", |
| 121 | "comment": "Used to get read/unread notifications for a user", |
| 122 | "columns": [ "notification_user", "notification_read_timestamp" ], |
| 123 | "unique": false |
| 124 | } |
| 125 | ], |
| 126 | "pk": [ "notification_user", "notification_event" ] |
| 127 | }, |
| 128 | { |
| 129 | "name": "echo_email_batch", |
| 130 | "comment": "Table gathering events for batch emails. If a user asks to receive batch emails, events are gathered in this table until it's time to send an email. Once a user has been emailed about an event, it's deleted from this table.", |
| 131 | "columns": [ |
| 132 | { |
| 133 | "name": "eeb_id", |
| 134 | "comment": "Unique auto-increment ID", |
| 135 | "type": "integer", |
| 136 | "options": { "autoincrement": true, "notnull": true, "unsigned": true } |
| 137 | }, |
| 138 | { |
| 139 | "name": "eeb_user_id", |
| 140 | "comment": "Key to user_id", |
| 141 | "type": "integer", |
| 142 | "options": { "notnull": true, "unsigned": true } |
| 143 | }, |
| 144 | { |
| 145 | "name": "eeb_event_priority", |
| 146 | "comment": "Priority of the event as defined in $wgEchoNotifications; events with lower numbers are listed first", |
| 147 | "type": "mwtinyint", |
| 148 | "options": { "notnull": true, "unsigned": true, "default": 10 } |
| 149 | }, |
| 150 | { |
| 151 | "name": "eeb_event_id", |
| 152 | "comment": "Key to event_id", |
| 153 | "type": "integer", |
| 154 | "options": { "notnull": true, "unsigned": true } |
| 155 | }, |
| 156 | { |
| 157 | "name": "eeb_event_hash", |
| 158 | "comment": "Same value as notification_bundle_hash, or a unique value if notification_bundle_hash is empty", |
| 159 | "type": "binary", |
| 160 | "options": { "notnull": true, "length": 32 } |
| 161 | } |
| 162 | ], |
| 163 | "indexes": [ |
| 164 | { |
| 165 | "name": "echo_email_batch_user_event", |
| 166 | "comment": "Used to delete events once they have been processed, and to identify users with events to process", |
| 167 | "columns": [ "eeb_user_id", "eeb_event_id" ], |
| 168 | "unique": true |
| 169 | }, |
| 170 | { |
| 171 | "name": "echo_email_batch_user_hash_priority", |
| 172 | "comment": "Used to get a list of events for a user, grouping events with the same hash and ordering by priority", |
| 173 | "columns": [ "eeb_user_id", "eeb_event_hash", "eeb_event_priority" ], |
| 174 | "unique": false |
| 175 | } |
| 176 | ], |
| 177 | "pk": [ "eeb_id" ] |
| 178 | }, |
| 179 | { |
| 180 | "name": "echo_target_page", |
| 181 | "comment": "A \"target page\" of an event is a page that, when the user visits it, causes the event to be marked as read. Typically this is the same as the event's event_page_id, but some events have multiple target pages, and many events don't set a target page at all. An event's target pages are derived from the 'target-page' key in event_extra. This table is also used for moderating events when the related page is deleted, but this should use event_page_id instead (T217452).", |
| 182 | "columns": [ |
| 183 | { |
| 184 | "name": "etp_id", |
| 185 | "comment": "Unique auto-increment ID", |
| 186 | "type": "integer", |
| 187 | "options": { "autoincrement": true, "notnull": true, "unsigned": true } |
| 188 | }, |
| 189 | { |
| 190 | "name": "etp_page", |
| 191 | "comment": "Key to page_id", |
| 192 | "type": "integer", |
| 193 | "options": { "notnull": true, "unsigned": true, "default": 0 } |
| 194 | }, |
| 195 | { |
| 196 | "name": "etp_event", |
| 197 | "comment": "Key to event_id", |
| 198 | "type": "integer", |
| 199 | "options": { "notnull": true, "unsigned": true, "default": 0 } |
| 200 | } |
| 201 | ], |
| 202 | "indexes": [ |
| 203 | { |
| 204 | "name": "echo_target_page_event", |
| 205 | "comment": "Not currently used", |
| 206 | "columns": [ "etp_event" ], |
| 207 | "unique": false |
| 208 | }, |
| 209 | { |
| 210 | "name": "echo_target_page_page_event", |
| 211 | "comment": "Used to get the events associated with a given page", |
| 212 | "columns": [ "etp_page", "etp_event" ], |
| 213 | "unique": false |
| 214 | } |
| 215 | ], |
| 216 | "pk": [ "etp_id" ] |
| 217 | }, |
| 218 | { |
| 219 | "name": "echo_push_provider", |
| 220 | "comment": "Table for normalizing push providers; intended for use with the NameTableStore construct.", |
| 221 | "columns": [ |
| 222 | { |
| 223 | "name": "epp_id", |
| 224 | "type": "mwtinyint", |
| 225 | "options": { "autoincrement": true, "notnull": true, "unsigned": true } |
| 226 | }, |
| 227 | { |
| 228 | "name": "epp_name", |
| 229 | "comment": "push provider name; expected values are 'fcm' and 'apns'", |
| 230 | "type": "blob", |
| 231 | "options": { "notnull": true, "length": 255 } |
| 232 | } |
| 233 | ], |
| 234 | "indexes": [], |
| 235 | "pk": [ "epp_id" ] |
| 236 | }, |
| 237 | { |
| 238 | "name": "echo_push_subscription", |
| 239 | "comment": "Stores push subscriptions associated with wiki users.", |
| 240 | "columns": [ |
| 241 | { |
| 242 | "name": "eps_id", |
| 243 | "type": "integer", |
| 244 | "options": { "autoincrement": true, "notnull": true, "unsigned": true } |
| 245 | }, |
| 246 | { |
| 247 | "name": "eps_user", |
| 248 | "comment": "central user ID", |
| 249 | "type": "integer", |
| 250 | "options": { "notnull": true, "unsigned": true } |
| 251 | }, |
| 252 | { |
| 253 | "name": "eps_token", |
| 254 | "comment": "platform-provided push subscription token", |
| 255 | "type": "blob", |
| 256 | "options": { "notnull": true, "length": 65530 } |
| 257 | }, |
| 258 | { |
| 259 | "name": "eps_token_sha256", |
| 260 | "comment": "SHA256 digest of the push subscription token (to be used as a uniqueness constraint, since the tokens themselves may be large)", |
| 261 | "type": "string", |
| 262 | "options": { "notnull": true, "length": 64, "fixed": true } |
| 263 | }, |
| 264 | { |
| 265 | "name": "eps_provider", |
| 266 | "comment": "push provider ID, expected to reference values 'fcm' or 'apns'", |
| 267 | "type": "mwtinyint", |
| 268 | "options": { "notnull": true, "unsigned": true } |
| 269 | }, |
| 270 | { |
| 271 | "name": "eps_updated", |
| 272 | "comment": "last updated timestamp", |
| 273 | "type": "datetimetz", |
| 274 | "options": { "notnull": true, "PlatformOptions": { "version": true } } |
| 275 | }, |
| 276 | { |
| 277 | "name": "eps_data", |
| 278 | "comment": "push subscription metadata (e.g APNS notification topic)", |
| 279 | "type": "blob", |
| 280 | "options": { "notnull": false, "length": 65530 } |
| 281 | }, |
| 282 | { |
| 283 | "name": "eps_topic", |
| 284 | "comment": "APNS topic ID, references a row ID (ept_id) from echo_push_topic", |
| 285 | "type": "mwtinyint", |
| 286 | "options": { "notnull": false, "unsigned": true } |
| 287 | } |
| 288 | ], |
| 289 | "indexes": [ |
| 290 | { |
| 291 | "name": "eps_token_sha256", |
| 292 | "columns": [ "eps_token_sha256" ], |
| 293 | "unique": true |
| 294 | }, |
| 295 | { |
| 296 | "name": "eps_provider", |
| 297 | "columns": [ "eps_provider" ], |
| 298 | "unique": false |
| 299 | }, |
| 300 | { |
| 301 | "name": "eps_topic", |
| 302 | "columns": [ "eps_topic" ], |
| 303 | "unique": false |
| 304 | }, |
| 305 | { |
| 306 | "name": "eps_user", |
| 307 | "columns": [ "eps_user" ], |
| 308 | "unique": false |
| 309 | }, |
| 310 | { |
| 311 | "name": "eps_token", |
| 312 | "columns": [ "eps_token" ], |
| 313 | "options": { "lengths": [ 10 ] }, |
| 314 | "unique": false |
| 315 | } |
| 316 | ], |
| 317 | "pk": [ "eps_id" ] |
| 318 | }, |
| 319 | { |
| 320 | "name": "echo_push_topic", |
| 321 | "comment": "Table for normalizing APNS push message topics, for use with the NameTableStore construct.", |
| 322 | "columns": [ |
| 323 | { |
| 324 | "name": "ept_id", |
| 325 | "type": "mwtinyint", |
| 326 | "options": { "autoincrement": true, "notnull": true, "unsigned": true } |
| 327 | }, |
| 328 | { |
| 329 | "name": "ept_text", |
| 330 | "comment": "full topic text", |
| 331 | "type": "blob", |
| 332 | "options": { "notnull": true, "length": 255 } |
| 333 | } |
| 334 | ], |
| 335 | "indexes": [], |
| 336 | "pk": [ "ept_id" ] |
| 337 | } |
| 338 | ] |