matrix-synapse 1.142.0rc3__cp314-abi3-musllinux_1_2_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of matrix-synapse might be problematic. Click here for more details.

Files changed (1057) hide show
  1. matrix_synapse-1.142.0rc3.dist-info/AUTHORS.rst +51 -0
  2. matrix_synapse-1.142.0rc3.dist-info/LICENSE-AGPL-3.0 +661 -0
  3. matrix_synapse-1.142.0rc3.dist-info/LICENSE-COMMERCIAL +6 -0
  4. matrix_synapse-1.142.0rc3.dist-info/METADATA +375 -0
  5. matrix_synapse-1.142.0rc3.dist-info/RECORD +1057 -0
  6. matrix_synapse-1.142.0rc3.dist-info/WHEEL +4 -0
  7. matrix_synapse-1.142.0rc3.dist-info/entry_points.txt +14 -0
  8. matrix_synapse.libs/libgcc_s-2d945d6c.so.1 +0 -0
  9. synapse/__init__.py +97 -0
  10. synapse/_scripts/__init__.py +0 -0
  11. synapse/_scripts/export_signing_key.py +109 -0
  12. synapse/_scripts/generate_config.py +83 -0
  13. synapse/_scripts/generate_log_config.py +56 -0
  14. synapse/_scripts/generate_signing_key.py +55 -0
  15. synapse/_scripts/generate_workers_map.py +318 -0
  16. synapse/_scripts/hash_password.py +95 -0
  17. synapse/_scripts/move_remote_media_to_new_store.py +128 -0
  18. synapse/_scripts/register_new_matrix_user.py +374 -0
  19. synapse/_scripts/review_recent_signups.py +212 -0
  20. synapse/_scripts/synapse_port_db.py +1603 -0
  21. synapse/_scripts/synctl.py +365 -0
  22. synapse/_scripts/update_synapse_database.py +130 -0
  23. synapse/api/__init__.py +20 -0
  24. synapse/api/auth/__init__.py +207 -0
  25. synapse/api/auth/base.py +406 -0
  26. synapse/api/auth/internal.py +299 -0
  27. synapse/api/auth/mas.py +457 -0
  28. synapse/api/auth/msc3861_delegated.py +617 -0
  29. synapse/api/auth_blocking.py +144 -0
  30. synapse/api/constants.py +362 -0
  31. synapse/api/errors.py +907 -0
  32. synapse/api/filtering.py +539 -0
  33. synapse/api/presence.py +104 -0
  34. synapse/api/ratelimiting.py +482 -0
  35. synapse/api/room_versions.py +535 -0
  36. synapse/api/urls.py +119 -0
  37. synapse/app/__init__.py +60 -0
  38. synapse/app/_base.py +866 -0
  39. synapse/app/admin_cmd.py +388 -0
  40. synapse/app/appservice.py +30 -0
  41. synapse/app/client_reader.py +30 -0
  42. synapse/app/complement_fork_starter.py +206 -0
  43. synapse/app/event_creator.py +29 -0
  44. synapse/app/federation_reader.py +30 -0
  45. synapse/app/federation_sender.py +30 -0
  46. synapse/app/frontend_proxy.py +30 -0
  47. synapse/app/generic_worker.py +475 -0
  48. synapse/app/homeserver.py +504 -0
  49. synapse/app/media_repository.py +30 -0
  50. synapse/app/phone_stats_home.py +296 -0
  51. synapse/app/pusher.py +30 -0
  52. synapse/app/synchrotron.py +30 -0
  53. synapse/app/user_dir.py +31 -0
  54. synapse/appservice/__init__.py +461 -0
  55. synapse/appservice/api.py +569 -0
  56. synapse/appservice/scheduler.py +567 -0
  57. synapse/config/__init__.py +27 -0
  58. synapse/config/__main__.py +62 -0
  59. synapse/config/_base.py +1108 -0
  60. synapse/config/_base.pyi +217 -0
  61. synapse/config/_util.py +99 -0
  62. synapse/config/account_validity.py +116 -0
  63. synapse/config/api.py +141 -0
  64. synapse/config/appservice.py +210 -0
  65. synapse/config/auth.py +80 -0
  66. synapse/config/auto_accept_invites.py +43 -0
  67. synapse/config/background_updates.py +44 -0
  68. synapse/config/cache.py +231 -0
  69. synapse/config/captcha.py +90 -0
  70. synapse/config/cas.py +116 -0
  71. synapse/config/consent.py +73 -0
  72. synapse/config/database.py +184 -0
  73. synapse/config/emailconfig.py +367 -0
  74. synapse/config/experimental.py +595 -0
  75. synapse/config/federation.py +114 -0
  76. synapse/config/homeserver.py +141 -0
  77. synapse/config/jwt.py +55 -0
  78. synapse/config/key.py +447 -0
  79. synapse/config/logger.py +390 -0
  80. synapse/config/mas.py +191 -0
  81. synapse/config/matrixrtc.py +66 -0
  82. synapse/config/metrics.py +84 -0
  83. synapse/config/modules.py +40 -0
  84. synapse/config/oembed.py +185 -0
  85. synapse/config/oidc.py +509 -0
  86. synapse/config/password_auth_providers.py +82 -0
  87. synapse/config/push.py +64 -0
  88. synapse/config/ratelimiting.py +254 -0
  89. synapse/config/redis.py +74 -0
  90. synapse/config/registration.py +296 -0
  91. synapse/config/repository.py +311 -0
  92. synapse/config/retention.py +162 -0
  93. synapse/config/room.py +88 -0
  94. synapse/config/room_directory.py +165 -0
  95. synapse/config/saml2.py +251 -0
  96. synapse/config/server.py +1170 -0
  97. synapse/config/server_notices.py +84 -0
  98. synapse/config/spam_checker.py +66 -0
  99. synapse/config/sso.py +121 -0
  100. synapse/config/stats.py +54 -0
  101. synapse/config/third_party_event_rules.py +40 -0
  102. synapse/config/tls.py +192 -0
  103. synapse/config/tracer.py +71 -0
  104. synapse/config/user_directory.py +47 -0
  105. synapse/config/user_types.py +44 -0
  106. synapse/config/voip.py +59 -0
  107. synapse/config/workers.py +642 -0
  108. synapse/crypto/__init__.py +20 -0
  109. synapse/crypto/context_factory.py +278 -0
  110. synapse/crypto/event_signing.py +194 -0
  111. synapse/crypto/keyring.py +931 -0
  112. synapse/event_auth.py +1266 -0
  113. synapse/events/__init__.py +668 -0
  114. synapse/events/auto_accept_invites.py +216 -0
  115. synapse/events/builder.py +387 -0
  116. synapse/events/presence_router.py +245 -0
  117. synapse/events/snapshot.py +559 -0
  118. synapse/events/utils.py +928 -0
  119. synapse/events/validator.py +305 -0
  120. synapse/federation/__init__.py +22 -0
  121. synapse/federation/federation_base.py +383 -0
  122. synapse/federation/federation_client.py +2134 -0
  123. synapse/federation/federation_server.py +1544 -0
  124. synapse/federation/persistence.py +71 -0
  125. synapse/federation/send_queue.py +532 -0
  126. synapse/federation/sender/__init__.py +1165 -0
  127. synapse/federation/sender/per_destination_queue.py +884 -0
  128. synapse/federation/sender/transaction_manager.py +210 -0
  129. synapse/federation/transport/__init__.py +28 -0
  130. synapse/federation/transport/client.py +1201 -0
  131. synapse/federation/transport/server/__init__.py +334 -0
  132. synapse/federation/transport/server/_base.py +429 -0
  133. synapse/federation/transport/server/federation.py +912 -0
  134. synapse/federation/units.py +133 -0
  135. synapse/handlers/__init__.py +20 -0
  136. synapse/handlers/account.py +162 -0
  137. synapse/handlers/account_data.py +362 -0
  138. synapse/handlers/account_validity.py +361 -0
  139. synapse/handlers/admin.py +618 -0
  140. synapse/handlers/appservice.py +991 -0
  141. synapse/handlers/auth.py +2494 -0
  142. synapse/handlers/cas.py +413 -0
  143. synapse/handlers/deactivate_account.py +363 -0
  144. synapse/handlers/delayed_events.py +635 -0
  145. synapse/handlers/device.py +1873 -0
  146. synapse/handlers/devicemessage.py +399 -0
  147. synapse/handlers/directory.py +554 -0
  148. synapse/handlers/e2e_keys.py +1834 -0
  149. synapse/handlers/e2e_room_keys.py +455 -0
  150. synapse/handlers/event_auth.py +390 -0
  151. synapse/handlers/events.py +201 -0
  152. synapse/handlers/federation.py +2043 -0
  153. synapse/handlers/federation_event.py +2420 -0
  154. synapse/handlers/identity.py +812 -0
  155. synapse/handlers/initial_sync.py +528 -0
  156. synapse/handlers/jwt.py +120 -0
  157. synapse/handlers/message.py +2347 -0
  158. synapse/handlers/oidc.py +1803 -0
  159. synapse/handlers/pagination.py +768 -0
  160. synapse/handlers/password_policy.py +102 -0
  161. synapse/handlers/presence.py +2638 -0
  162. synapse/handlers/profile.py +655 -0
  163. synapse/handlers/push_rules.py +164 -0
  164. synapse/handlers/read_marker.py +79 -0
  165. synapse/handlers/receipts.py +351 -0
  166. synapse/handlers/register.py +1060 -0
  167. synapse/handlers/relations.py +624 -0
  168. synapse/handlers/reports.py +98 -0
  169. synapse/handlers/room.py +2447 -0
  170. synapse/handlers/room_list.py +632 -0
  171. synapse/handlers/room_member.py +2365 -0
  172. synapse/handlers/room_member_worker.py +146 -0
  173. synapse/handlers/room_policy.py +186 -0
  174. synapse/handlers/room_summary.py +1057 -0
  175. synapse/handlers/saml.py +524 -0
  176. synapse/handlers/search.py +723 -0
  177. synapse/handlers/send_email.py +209 -0
  178. synapse/handlers/set_password.py +71 -0
  179. synapse/handlers/sliding_sync/__init__.py +1701 -0
  180. synapse/handlers/sliding_sync/extensions.py +970 -0
  181. synapse/handlers/sliding_sync/room_lists.py +2266 -0
  182. synapse/handlers/sliding_sync/store.py +128 -0
  183. synapse/handlers/sso.py +1292 -0
  184. synapse/handlers/state_deltas.py +82 -0
  185. synapse/handlers/stats.py +322 -0
  186. synapse/handlers/sync.py +3109 -0
  187. synapse/handlers/thread_subscriptions.py +190 -0
  188. synapse/handlers/typing.py +606 -0
  189. synapse/handlers/ui_auth/__init__.py +48 -0
  190. synapse/handlers/ui_auth/checkers.py +332 -0
  191. synapse/handlers/user_directory.py +783 -0
  192. synapse/handlers/worker_lock.py +365 -0
  193. synapse/http/__init__.py +106 -0
  194. synapse/http/additional_resource.py +62 -0
  195. synapse/http/client.py +1360 -0
  196. synapse/http/connectproxyclient.py +309 -0
  197. synapse/http/federation/__init__.py +19 -0
  198. synapse/http/federation/matrix_federation_agent.py +490 -0
  199. synapse/http/federation/srv_resolver.py +196 -0
  200. synapse/http/federation/well_known_resolver.py +367 -0
  201. synapse/http/matrixfederationclient.py +1875 -0
  202. synapse/http/proxy.py +290 -0
  203. synapse/http/proxyagent.py +497 -0
  204. synapse/http/replicationagent.py +203 -0
  205. synapse/http/request_metrics.py +309 -0
  206. synapse/http/server.py +1114 -0
  207. synapse/http/servlet.py +1019 -0
  208. synapse/http/site.py +825 -0
  209. synapse/http/types.py +27 -0
  210. synapse/logging/__init__.py +31 -0
  211. synapse/logging/_remote.py +261 -0
  212. synapse/logging/_terse_json.py +95 -0
  213. synapse/logging/context.py +1211 -0
  214. synapse/logging/formatter.py +63 -0
  215. synapse/logging/handlers.py +99 -0
  216. synapse/logging/loggers.py +25 -0
  217. synapse/logging/opentracing.py +1132 -0
  218. synapse/logging/scopecontextmanager.py +161 -0
  219. synapse/media/_base.py +827 -0
  220. synapse/media/filepath.py +417 -0
  221. synapse/media/media_repository.py +1580 -0
  222. synapse/media/media_storage.py +704 -0
  223. synapse/media/oembed.py +277 -0
  224. synapse/media/preview_html.py +559 -0
  225. synapse/media/storage_provider.py +195 -0
  226. synapse/media/thumbnailer.py +833 -0
  227. synapse/media/url_previewer.py +875 -0
  228. synapse/metrics/__init__.py +754 -0
  229. synapse/metrics/_gc.py +219 -0
  230. synapse/metrics/_reactor_metrics.py +171 -0
  231. synapse/metrics/_types.py +38 -0
  232. synapse/metrics/background_process_metrics.py +556 -0
  233. synapse/metrics/common_usage_metrics.py +94 -0
  234. synapse/metrics/jemalloc.py +248 -0
  235. synapse/module_api/__init__.py +2154 -0
  236. synapse/module_api/callbacks/__init__.py +50 -0
  237. synapse/module_api/callbacks/account_validity_callbacks.py +106 -0
  238. synapse/module_api/callbacks/media_repository_callbacks.py +160 -0
  239. synapse/module_api/callbacks/ratelimit_callbacks.py +79 -0
  240. synapse/module_api/callbacks/spamchecker_callbacks.py +1113 -0
  241. synapse/module_api/callbacks/third_party_event_rules_callbacks.py +599 -0
  242. synapse/module_api/errors.py +42 -0
  243. synapse/notifier.py +972 -0
  244. synapse/push/__init__.py +212 -0
  245. synapse/push/bulk_push_rule_evaluator.py +637 -0
  246. synapse/push/clientformat.py +126 -0
  247. synapse/push/emailpusher.py +333 -0
  248. synapse/push/httppusher.py +564 -0
  249. synapse/push/mailer.py +1012 -0
  250. synapse/push/presentable_names.py +216 -0
  251. synapse/push/push_tools.py +114 -0
  252. synapse/push/push_types.py +141 -0
  253. synapse/push/pusher.py +87 -0
  254. synapse/push/pusherpool.py +501 -0
  255. synapse/push/rulekinds.py +33 -0
  256. synapse/py.typed +0 -0
  257. synapse/replication/__init__.py +20 -0
  258. synapse/replication/http/__init__.py +68 -0
  259. synapse/replication/http/_base.py +468 -0
  260. synapse/replication/http/account_data.py +297 -0
  261. synapse/replication/http/deactivate_account.py +81 -0
  262. synapse/replication/http/delayed_events.py +62 -0
  263. synapse/replication/http/devices.py +254 -0
  264. synapse/replication/http/federation.py +334 -0
  265. synapse/replication/http/login.py +106 -0
  266. synapse/replication/http/membership.py +364 -0
  267. synapse/replication/http/presence.py +133 -0
  268. synapse/replication/http/push.py +156 -0
  269. synapse/replication/http/register.py +172 -0
  270. synapse/replication/http/send_events.py +182 -0
  271. synapse/replication/http/state.py +82 -0
  272. synapse/replication/http/streams.py +101 -0
  273. synapse/replication/tcp/__init__.py +56 -0
  274. synapse/replication/tcp/client.py +552 -0
  275. synapse/replication/tcp/commands.py +569 -0
  276. synapse/replication/tcp/context.py +41 -0
  277. synapse/replication/tcp/external_cache.py +156 -0
  278. synapse/replication/tcp/handler.py +942 -0
  279. synapse/replication/tcp/protocol.py +608 -0
  280. synapse/replication/tcp/redis.py +509 -0
  281. synapse/replication/tcp/resource.py +348 -0
  282. synapse/replication/tcp/streams/__init__.py +96 -0
  283. synapse/replication/tcp/streams/_base.py +766 -0
  284. synapse/replication/tcp/streams/events.py +287 -0
  285. synapse/replication/tcp/streams/federation.py +92 -0
  286. synapse/replication/tcp/streams/partial_state.py +80 -0
  287. synapse/res/providers.json +29 -0
  288. synapse/res/templates/_base.html +29 -0
  289. synapse/res/templates/account_previously_renewed.html +6 -0
  290. synapse/res/templates/account_renewed.html +6 -0
  291. synapse/res/templates/add_threepid.html +8 -0
  292. synapse/res/templates/add_threepid.txt +6 -0
  293. synapse/res/templates/add_threepid_failure.html +7 -0
  294. synapse/res/templates/add_threepid_success.html +6 -0
  295. synapse/res/templates/already_in_use.html +12 -0
  296. synapse/res/templates/already_in_use.txt +10 -0
  297. synapse/res/templates/auth_success.html +21 -0
  298. synapse/res/templates/invalid_token.html +6 -0
  299. synapse/res/templates/mail-Element.css +7 -0
  300. synapse/res/templates/mail-Vector.css +7 -0
  301. synapse/res/templates/mail-expiry.css +4 -0
  302. synapse/res/templates/mail.css +156 -0
  303. synapse/res/templates/notice_expiry.html +46 -0
  304. synapse/res/templates/notice_expiry.txt +7 -0
  305. synapse/res/templates/notif.html +51 -0
  306. synapse/res/templates/notif.txt +22 -0
  307. synapse/res/templates/notif_mail.html +59 -0
  308. synapse/res/templates/notif_mail.txt +10 -0
  309. synapse/res/templates/password_reset.html +10 -0
  310. synapse/res/templates/password_reset.txt +7 -0
  311. synapse/res/templates/password_reset_confirmation.html +15 -0
  312. synapse/res/templates/password_reset_failure.html +7 -0
  313. synapse/res/templates/password_reset_success.html +6 -0
  314. synapse/res/templates/recaptcha.html +42 -0
  315. synapse/res/templates/registration.html +12 -0
  316. synapse/res/templates/registration.txt +10 -0
  317. synapse/res/templates/registration_failure.html +6 -0
  318. synapse/res/templates/registration_success.html +6 -0
  319. synapse/res/templates/registration_token.html +18 -0
  320. synapse/res/templates/room.html +33 -0
  321. synapse/res/templates/room.txt +9 -0
  322. synapse/res/templates/sso.css +129 -0
  323. synapse/res/templates/sso_account_deactivated.html +25 -0
  324. synapse/res/templates/sso_auth_account_details.html +186 -0
  325. synapse/res/templates/sso_auth_account_details.js +116 -0
  326. synapse/res/templates/sso_auth_bad_user.html +26 -0
  327. synapse/res/templates/sso_auth_confirm.html +27 -0
  328. synapse/res/templates/sso_auth_success.html +26 -0
  329. synapse/res/templates/sso_error.html +71 -0
  330. synapse/res/templates/sso_footer.html +19 -0
  331. synapse/res/templates/sso_login_idp_picker.html +60 -0
  332. synapse/res/templates/sso_new_user_consent.html +30 -0
  333. synapse/res/templates/sso_partial_profile.html +19 -0
  334. synapse/res/templates/sso_redirect_confirm.html +39 -0
  335. synapse/res/templates/style.css +33 -0
  336. synapse/res/templates/terms.html +27 -0
  337. synapse/rest/__init__.py +197 -0
  338. synapse/rest/admin/__init__.py +390 -0
  339. synapse/rest/admin/_base.py +72 -0
  340. synapse/rest/admin/background_updates.py +171 -0
  341. synapse/rest/admin/devices.py +221 -0
  342. synapse/rest/admin/event_reports.py +173 -0
  343. synapse/rest/admin/events.py +69 -0
  344. synapse/rest/admin/experimental_features.py +137 -0
  345. synapse/rest/admin/federation.py +243 -0
  346. synapse/rest/admin/media.py +540 -0
  347. synapse/rest/admin/registration_tokens.py +358 -0
  348. synapse/rest/admin/rooms.py +1061 -0
  349. synapse/rest/admin/scheduled_tasks.py +70 -0
  350. synapse/rest/admin/server_notice_servlet.py +132 -0
  351. synapse/rest/admin/statistics.py +132 -0
  352. synapse/rest/admin/username_available.py +58 -0
  353. synapse/rest/admin/users.py +1608 -0
  354. synapse/rest/client/__init__.py +20 -0
  355. synapse/rest/client/_base.py +113 -0
  356. synapse/rest/client/account.py +930 -0
  357. synapse/rest/client/account_data.py +319 -0
  358. synapse/rest/client/account_validity.py +103 -0
  359. synapse/rest/client/appservice_ping.py +125 -0
  360. synapse/rest/client/auth.py +218 -0
  361. synapse/rest/client/auth_metadata.py +122 -0
  362. synapse/rest/client/capabilities.py +121 -0
  363. synapse/rest/client/delayed_events.py +111 -0
  364. synapse/rest/client/devices.py +587 -0
  365. synapse/rest/client/directory.py +211 -0
  366. synapse/rest/client/events.py +116 -0
  367. synapse/rest/client/filter.py +112 -0
  368. synapse/rest/client/initial_sync.py +65 -0
  369. synapse/rest/client/keys.py +678 -0
  370. synapse/rest/client/knock.py +104 -0
  371. synapse/rest/client/login.py +754 -0
  372. synapse/rest/client/login_token_request.py +127 -0
  373. synapse/rest/client/logout.py +93 -0
  374. synapse/rest/client/matrixrtc.py +52 -0
  375. synapse/rest/client/media.py +286 -0
  376. synapse/rest/client/mutual_rooms.py +93 -0
  377. synapse/rest/client/notifications.py +137 -0
  378. synapse/rest/client/openid.py +109 -0
  379. synapse/rest/client/password_policy.py +69 -0
  380. synapse/rest/client/presence.py +131 -0
  381. synapse/rest/client/profile.py +291 -0
  382. synapse/rest/client/push_rule.py +331 -0
  383. synapse/rest/client/pusher.py +181 -0
  384. synapse/rest/client/read_marker.py +104 -0
  385. synapse/rest/client/receipts.py +165 -0
  386. synapse/rest/client/register.py +1067 -0
  387. synapse/rest/client/relations.py +138 -0
  388. synapse/rest/client/rendezvous.py +76 -0
  389. synapse/rest/client/reporting.py +207 -0
  390. synapse/rest/client/room.py +1669 -0
  391. synapse/rest/client/room_keys.py +426 -0
  392. synapse/rest/client/room_upgrade_rest_servlet.py +112 -0
  393. synapse/rest/client/sendtodevice.py +85 -0
  394. synapse/rest/client/sync.py +1131 -0
  395. synapse/rest/client/tags.py +129 -0
  396. synapse/rest/client/thirdparty.py +130 -0
  397. synapse/rest/client/thread_subscriptions.py +247 -0
  398. synapse/rest/client/tokenrefresh.py +52 -0
  399. synapse/rest/client/transactions.py +149 -0
  400. synapse/rest/client/user_directory.py +90 -0
  401. synapse/rest/client/versions.py +191 -0
  402. synapse/rest/client/voip.py +88 -0
  403. synapse/rest/consent/__init__.py +0 -0
  404. synapse/rest/consent/consent_resource.py +210 -0
  405. synapse/rest/health.py +38 -0
  406. synapse/rest/key/__init__.py +20 -0
  407. synapse/rest/key/v2/__init__.py +40 -0
  408. synapse/rest/key/v2/local_key_resource.py +125 -0
  409. synapse/rest/key/v2/remote_key_resource.py +302 -0
  410. synapse/rest/media/__init__.py +0 -0
  411. synapse/rest/media/config_resource.py +53 -0
  412. synapse/rest/media/create_resource.py +90 -0
  413. synapse/rest/media/download_resource.py +110 -0
  414. synapse/rest/media/media_repository_resource.py +113 -0
  415. synapse/rest/media/preview_url_resource.py +77 -0
  416. synapse/rest/media/thumbnail_resource.py +142 -0
  417. synapse/rest/media/upload_resource.py +187 -0
  418. synapse/rest/media/v1/__init__.py +39 -0
  419. synapse/rest/media/v1/_base.py +23 -0
  420. synapse/rest/media/v1/media_storage.py +23 -0
  421. synapse/rest/media/v1/storage_provider.py +23 -0
  422. synapse/rest/synapse/__init__.py +20 -0
  423. synapse/rest/synapse/client/__init__.py +93 -0
  424. synapse/rest/synapse/client/federation_whitelist.py +66 -0
  425. synapse/rest/synapse/client/jwks.py +77 -0
  426. synapse/rest/synapse/client/new_user_consent.py +115 -0
  427. synapse/rest/synapse/client/oidc/__init__.py +45 -0
  428. synapse/rest/synapse/client/oidc/backchannel_logout_resource.py +42 -0
  429. synapse/rest/synapse/client/oidc/callback_resource.py +48 -0
  430. synapse/rest/synapse/client/password_reset.py +129 -0
  431. synapse/rest/synapse/client/pick_idp.py +107 -0
  432. synapse/rest/synapse/client/pick_username.py +153 -0
  433. synapse/rest/synapse/client/rendezvous.py +58 -0
  434. synapse/rest/synapse/client/saml2/__init__.py +42 -0
  435. synapse/rest/synapse/client/saml2/metadata_resource.py +46 -0
  436. synapse/rest/synapse/client/saml2/response_resource.py +52 -0
  437. synapse/rest/synapse/client/sso_register.py +56 -0
  438. synapse/rest/synapse/client/unsubscribe.py +88 -0
  439. synapse/rest/synapse/mas/__init__.py +71 -0
  440. synapse/rest/synapse/mas/_base.py +55 -0
  441. synapse/rest/synapse/mas/devices.py +239 -0
  442. synapse/rest/synapse/mas/users.py +469 -0
  443. synapse/rest/well_known.py +148 -0
  444. synapse/server.py +1258 -0
  445. synapse/server_notices/__init__.py +0 -0
  446. synapse/server_notices/consent_server_notices.py +136 -0
  447. synapse/server_notices/resource_limits_server_notices.py +215 -0
  448. synapse/server_notices/server_notices_manager.py +388 -0
  449. synapse/server_notices/server_notices_sender.py +67 -0
  450. synapse/server_notices/worker_server_notices_sender.py +46 -0
  451. synapse/spam_checker_api/__init__.py +31 -0
  452. synapse/state/__init__.py +1022 -0
  453. synapse/state/v1.py +370 -0
  454. synapse/state/v2.py +985 -0
  455. synapse/static/client/login/index.html +47 -0
  456. synapse/static/client/login/js/jquery-3.4.1.min.js +2 -0
  457. synapse/static/client/login/js/login.js +291 -0
  458. synapse/static/client/login/spinner.gif +0 -0
  459. synapse/static/client/login/style.css +79 -0
  460. synapse/static/index.html +63 -0
  461. synapse/storage/__init__.py +43 -0
  462. synapse/storage/_base.py +245 -0
  463. synapse/storage/admin_client_config.py +26 -0
  464. synapse/storage/background_updates.py +1189 -0
  465. synapse/storage/controllers/__init__.py +57 -0
  466. synapse/storage/controllers/persist_events.py +1239 -0
  467. synapse/storage/controllers/purge_events.py +456 -0
  468. synapse/storage/controllers/state.py +954 -0
  469. synapse/storage/controllers/stats.py +119 -0
  470. synapse/storage/database.py +2720 -0
  471. synapse/storage/databases/__init__.py +175 -0
  472. synapse/storage/databases/main/__init__.py +424 -0
  473. synapse/storage/databases/main/account_data.py +1060 -0
  474. synapse/storage/databases/main/appservice.py +473 -0
  475. synapse/storage/databases/main/cache.py +911 -0
  476. synapse/storage/databases/main/censor_events.py +225 -0
  477. synapse/storage/databases/main/client_ips.py +817 -0
  478. synapse/storage/databases/main/delayed_events.py +560 -0
  479. synapse/storage/databases/main/deviceinbox.py +1272 -0
  480. synapse/storage/databases/main/devices.py +2581 -0
  481. synapse/storage/databases/main/directory.py +212 -0
  482. synapse/storage/databases/main/e2e_room_keys.py +690 -0
  483. synapse/storage/databases/main/end_to_end_keys.py +1896 -0
  484. synapse/storage/databases/main/event_federation.py +2509 -0
  485. synapse/storage/databases/main/event_push_actions.py +1937 -0
  486. synapse/storage/databases/main/events.py +3746 -0
  487. synapse/storage/databases/main/events_bg_updates.py +2910 -0
  488. synapse/storage/databases/main/events_forward_extremities.py +126 -0
  489. synapse/storage/databases/main/events_worker.py +2784 -0
  490. synapse/storage/databases/main/experimental_features.py +130 -0
  491. synapse/storage/databases/main/filtering.py +231 -0
  492. synapse/storage/databases/main/keys.py +291 -0
  493. synapse/storage/databases/main/lock.py +553 -0
  494. synapse/storage/databases/main/media_repository.py +1070 -0
  495. synapse/storage/databases/main/metrics.py +460 -0
  496. synapse/storage/databases/main/monthly_active_users.py +443 -0
  497. synapse/storage/databases/main/openid.py +61 -0
  498. synapse/storage/databases/main/presence.py +511 -0
  499. synapse/storage/databases/main/profile.py +541 -0
  500. synapse/storage/databases/main/purge_events.py +511 -0
  501. synapse/storage/databases/main/push_rule.py +972 -0
  502. synapse/storage/databases/main/pusher.py +794 -0
  503. synapse/storage/databases/main/receipts.py +1342 -0
  504. synapse/storage/databases/main/registration.py +3076 -0
  505. synapse/storage/databases/main/rejections.py +38 -0
  506. synapse/storage/databases/main/relations.py +1118 -0
  507. synapse/storage/databases/main/room.py +2781 -0
  508. synapse/storage/databases/main/roommember.py +2112 -0
  509. synapse/storage/databases/main/search.py +941 -0
  510. synapse/storage/databases/main/session.py +151 -0
  511. synapse/storage/databases/main/signatures.py +94 -0
  512. synapse/storage/databases/main/sliding_sync.py +603 -0
  513. synapse/storage/databases/main/state.py +1006 -0
  514. synapse/storage/databases/main/state_deltas.py +329 -0
  515. synapse/storage/databases/main/stats.py +791 -0
  516. synapse/storage/databases/main/stream.py +2580 -0
  517. synapse/storage/databases/main/tags.py +360 -0
  518. synapse/storage/databases/main/task_scheduler.py +225 -0
  519. synapse/storage/databases/main/thread_subscriptions.py +591 -0
  520. synapse/storage/databases/main/transactions.py +681 -0
  521. synapse/storage/databases/main/ui_auth.py +420 -0
  522. synapse/storage/databases/main/user_directory.py +1331 -0
  523. synapse/storage/databases/main/user_erasure_store.py +117 -0
  524. synapse/storage/databases/state/__init__.py +22 -0
  525. synapse/storage/databases/state/bg_updates.py +499 -0
  526. synapse/storage/databases/state/deletion.py +558 -0
  527. synapse/storage/databases/state/store.py +949 -0
  528. synapse/storage/engines/__init__.py +70 -0
  529. synapse/storage/engines/_base.py +154 -0
  530. synapse/storage/engines/postgres.py +261 -0
  531. synapse/storage/engines/sqlite.py +199 -0
  532. synapse/storage/invite_rule.py +112 -0
  533. synapse/storage/keys.py +40 -0
  534. synapse/storage/prepare_database.py +731 -0
  535. synapse/storage/push_rule.py +28 -0
  536. synapse/storage/roommember.py +89 -0
  537. synapse/storage/schema/README.md +4 -0
  538. synapse/storage/schema/__init__.py +182 -0
  539. synapse/storage/schema/common/delta/25/00background_updates.sql +40 -0
  540. synapse/storage/schema/common/delta/35/00background_updates_add_col.sql +36 -0
  541. synapse/storage/schema/common/delta/58/00background_update_ordering.sql +38 -0
  542. synapse/storage/schema/common/full_schemas/72/full.sql.postgres +8 -0
  543. synapse/storage/schema/common/full_schemas/72/full.sql.sqlite +6 -0
  544. synapse/storage/schema/common/schema_version.sql +60 -0
  545. synapse/storage/schema/main/delta/12/v12.sql +82 -0
  546. synapse/storage/schema/main/delta/13/v13.sql +38 -0
  547. synapse/storage/schema/main/delta/14/v14.sql +42 -0
  548. synapse/storage/schema/main/delta/15/appservice_txns.sql +50 -0
  549. synapse/storage/schema/main/delta/15/presence_indices.sql +2 -0
  550. synapse/storage/schema/main/delta/15/v15.sql +24 -0
  551. synapse/storage/schema/main/delta/16/events_order_index.sql +4 -0
  552. synapse/storage/schema/main/delta/16/remote_media_cache_index.sql +2 -0
  553. synapse/storage/schema/main/delta/16/remove_duplicates.sql +9 -0
  554. synapse/storage/schema/main/delta/16/room_alias_index.sql +3 -0
  555. synapse/storage/schema/main/delta/16/unique_constraints.sql +72 -0
  556. synapse/storage/schema/main/delta/16/users.sql +56 -0
  557. synapse/storage/schema/main/delta/17/drop_indexes.sql +37 -0
  558. synapse/storage/schema/main/delta/17/server_keys.sql +43 -0
  559. synapse/storage/schema/main/delta/17/user_threepids.sql +9 -0
  560. synapse/storage/schema/main/delta/18/server_keys_bigger_ints.sql +51 -0
  561. synapse/storage/schema/main/delta/19/event_index.sql +38 -0
  562. synapse/storage/schema/main/delta/20/dummy.sql +1 -0
  563. synapse/storage/schema/main/delta/20/pushers.py +93 -0
  564. synapse/storage/schema/main/delta/21/end_to_end_keys.sql +53 -0
  565. synapse/storage/schema/main/delta/21/receipts.sql +57 -0
  566. synapse/storage/schema/main/delta/22/receipts_index.sql +41 -0
  567. synapse/storage/schema/main/delta/22/user_threepids_unique.sql +19 -0
  568. synapse/storage/schema/main/delta/24/stats_reporting.sql +37 -0
  569. synapse/storage/schema/main/delta/25/fts.py +81 -0
  570. synapse/storage/schema/main/delta/25/guest_access.sql +44 -0
  571. synapse/storage/schema/main/delta/25/history_visibility.sql +44 -0
  572. synapse/storage/schema/main/delta/25/tags.sql +57 -0
  573. synapse/storage/schema/main/delta/26/account_data.sql +36 -0
  574. synapse/storage/schema/main/delta/27/account_data.sql +55 -0
  575. synapse/storage/schema/main/delta/27/forgotten_memberships.sql +45 -0
  576. synapse/storage/schema/main/delta/27/ts.py +61 -0
  577. synapse/storage/schema/main/delta/28/event_push_actions.sql +46 -0
  578. synapse/storage/schema/main/delta/28/events_room_stream.sql +39 -0
  579. synapse/storage/schema/main/delta/28/public_roms_index.sql +39 -0
  580. synapse/storage/schema/main/delta/28/receipts_user_id_index.sql +41 -0
  581. synapse/storage/schema/main/delta/28/upgrade_times.sql +40 -0
  582. synapse/storage/schema/main/delta/28/users_is_guest.sql +41 -0
  583. synapse/storage/schema/main/delta/29/push_actions.sql +54 -0
  584. synapse/storage/schema/main/delta/30/alias_creator.sql +35 -0
  585. synapse/storage/schema/main/delta/30/as_users.py +82 -0
  586. synapse/storage/schema/main/delta/30/deleted_pushers.sql +44 -0
  587. synapse/storage/schema/main/delta/30/presence_stream.sql +49 -0
  588. synapse/storage/schema/main/delta/30/public_rooms.sql +42 -0
  589. synapse/storage/schema/main/delta/30/push_rule_stream.sql +57 -0
  590. synapse/storage/schema/main/delta/30/threepid_guest_access_tokens.sql +43 -0
  591. synapse/storage/schema/main/delta/31/invites.sql +61 -0
  592. synapse/storage/schema/main/delta/31/local_media_repository_url_cache.sql +46 -0
  593. synapse/storage/schema/main/delta/31/pushers_0.py +92 -0
  594. synapse/storage/schema/main/delta/31/pushers_index.sql +41 -0
  595. synapse/storage/schema/main/delta/31/search_update.py +65 -0
  596. synapse/storage/schema/main/delta/32/events.sql +35 -0
  597. synapse/storage/schema/main/delta/32/openid.sql +9 -0
  598. synapse/storage/schema/main/delta/32/pusher_throttle.sql +42 -0
  599. synapse/storage/schema/main/delta/32/remove_indices.sql +52 -0
  600. synapse/storage/schema/main/delta/32/reports.sql +44 -0
  601. synapse/storage/schema/main/delta/33/access_tokens_device_index.sql +36 -0
  602. synapse/storage/schema/main/delta/33/devices.sql +40 -0
  603. synapse/storage/schema/main/delta/33/devices_for_e2e_keys.sql +38 -0
  604. synapse/storage/schema/main/delta/33/devices_for_e2e_keys_clear_unknown_device.sql +39 -0
  605. synapse/storage/schema/main/delta/33/event_fields.py +61 -0
  606. synapse/storage/schema/main/delta/33/remote_media_ts.py +43 -0
  607. synapse/storage/schema/main/delta/33/user_ips_index.sql +36 -0
  608. synapse/storage/schema/main/delta/34/appservice_stream.sql +42 -0
  609. synapse/storage/schema/main/delta/34/cache_stream.py +50 -0
  610. synapse/storage/schema/main/delta/34/device_inbox.sql +43 -0
  611. synapse/storage/schema/main/delta/34/push_display_name_rename.sql +39 -0
  612. synapse/storage/schema/main/delta/34/received_txn_purge.py +36 -0
  613. synapse/storage/schema/main/delta/35/contains_url.sql +36 -0
  614. synapse/storage/schema/main/delta/35/device_outbox.sql +58 -0
  615. synapse/storage/schema/main/delta/35/device_stream_id.sql +40 -0
  616. synapse/storage/schema/main/delta/35/event_push_actions_index.sql +36 -0
  617. synapse/storage/schema/main/delta/35/public_room_list_change_stream.sql +52 -0
  618. synapse/storage/schema/main/delta/35/stream_order_to_extrem.sql +56 -0
  619. synapse/storage/schema/main/delta/36/readd_public_rooms.sql +45 -0
  620. synapse/storage/schema/main/delta/37/remove_auth_idx.py +89 -0
  621. synapse/storage/schema/main/delta/37/user_threepids.sql +71 -0
  622. synapse/storage/schema/main/delta/38/postgres_fts_gist.sql +38 -0
  623. synapse/storage/schema/main/delta/39/appservice_room_list.sql +48 -0
  624. synapse/storage/schema/main/delta/39/device_federation_stream_idx.sql +35 -0
  625. synapse/storage/schema/main/delta/39/event_push_index.sql +36 -0
  626. synapse/storage/schema/main/delta/39/federation_out_position.sql +41 -0
  627. synapse/storage/schema/main/delta/39/membership_profile.sql +39 -0
  628. synapse/storage/schema/main/delta/40/current_state_idx.sql +36 -0
  629. synapse/storage/schema/main/delta/40/device_inbox.sql +40 -0
  630. synapse/storage/schema/main/delta/40/device_list_streams.sql +79 -0
  631. synapse/storage/schema/main/delta/40/event_push_summary.sql +57 -0
  632. synapse/storage/schema/main/delta/40/pushers.sql +58 -0
  633. synapse/storage/schema/main/delta/41/device_list_stream_idx.sql +36 -0
  634. synapse/storage/schema/main/delta/41/device_outbound_index.sql +35 -0
  635. synapse/storage/schema/main/delta/41/event_search_event_id_idx.sql +36 -0
  636. synapse/storage/schema/main/delta/41/ratelimit.sql +41 -0
  637. synapse/storage/schema/main/delta/42/current_state_delta.sql +48 -0
  638. synapse/storage/schema/main/delta/42/device_list_last_id.sql +52 -0
  639. synapse/storage/schema/main/delta/42/event_auth_state_only.sql +36 -0
  640. synapse/storage/schema/main/delta/42/user_dir.py +88 -0
  641. synapse/storage/schema/main/delta/43/blocked_rooms.sql +40 -0
  642. synapse/storage/schema/main/delta/43/quarantine_media.sql +36 -0
  643. synapse/storage/schema/main/delta/43/url_cache.sql +35 -0
  644. synapse/storage/schema/main/delta/43/user_share.sql +52 -0
  645. synapse/storage/schema/main/delta/44/expire_url_cache.sql +60 -0
  646. synapse/storage/schema/main/delta/45/group_server.sql +186 -0
  647. synapse/storage/schema/main/delta/45/profile_cache.sql +47 -0
  648. synapse/storage/schema/main/delta/46/drop_refresh_tokens.sql +36 -0
  649. synapse/storage/schema/main/delta/46/drop_unique_deleted_pushers.sql +54 -0
  650. synapse/storage/schema/main/delta/46/group_server.sql +51 -0
  651. synapse/storage/schema/main/delta/46/local_media_repository_url_idx.sql +43 -0
  652. synapse/storage/schema/main/delta/46/user_dir_null_room_ids.sql +54 -0
  653. synapse/storage/schema/main/delta/46/user_dir_typos.sql +43 -0
  654. synapse/storage/schema/main/delta/47/last_access_media.sql +35 -0
  655. synapse/storage/schema/main/delta/47/postgres_fts_gin.sql +36 -0
  656. synapse/storage/schema/main/delta/47/push_actions_staging.sql +47 -0
  657. synapse/storage/schema/main/delta/48/add_user_consent.sql +37 -0
  658. synapse/storage/schema/main/delta/48/add_user_ips_last_seen_index.sql +36 -0
  659. synapse/storage/schema/main/delta/48/deactivated_users.sql +44 -0
  660. synapse/storage/schema/main/delta/48/group_unique_indexes.py +67 -0
  661. synapse/storage/schema/main/delta/48/groups_joinable.sql +41 -0
  662. synapse/storage/schema/main/delta/49/add_user_consent_server_notice_sent.sql +39 -0
  663. synapse/storage/schema/main/delta/49/add_user_daily_visits.sql +40 -0
  664. synapse/storage/schema/main/delta/49/add_user_ips_last_seen_only_index.sql +36 -0
  665. synapse/storage/schema/main/delta/50/add_creation_ts_users_index.sql +38 -0
  666. synapse/storage/schema/main/delta/50/erasure_store.sql +40 -0
  667. synapse/storage/schema/main/delta/50/make_event_content_nullable.py +102 -0
  668. synapse/storage/schema/main/delta/51/e2e_room_keys.sql +58 -0
  669. synapse/storage/schema/main/delta/51/monthly_active_users.sql +46 -0
  670. synapse/storage/schema/main/delta/52/add_event_to_state_group_index.sql +38 -0
  671. synapse/storage/schema/main/delta/52/device_list_streams_unique_idx.sql +55 -0
  672. synapse/storage/schema/main/delta/52/e2e_room_keys.sql +72 -0
  673. synapse/storage/schema/main/delta/53/add_user_type_to_users.sql +38 -0
  674. synapse/storage/schema/main/delta/53/drop_sent_transactions.sql +35 -0
  675. synapse/storage/schema/main/delta/53/event_format_version.sql +35 -0
  676. synapse/storage/schema/main/delta/53/user_dir_populate.sql +49 -0
  677. synapse/storage/schema/main/delta/53/user_ips_index.sql +49 -0
  678. synapse/storage/schema/main/delta/53/user_share.sql +63 -0
  679. synapse/storage/schema/main/delta/53/user_threepid_id.sql +48 -0
  680. synapse/storage/schema/main/delta/53/users_in_public_rooms.sql +47 -0
  681. synapse/storage/schema/main/delta/54/account_validity_with_renewal.sql +49 -0
  682. synapse/storage/schema/main/delta/54/add_validity_to_server_keys.sql +42 -0
  683. synapse/storage/schema/main/delta/54/delete_forward_extremities.sql +42 -0
  684. synapse/storage/schema/main/delta/54/drop_legacy_tables.sql +49 -0
  685. synapse/storage/schema/main/delta/54/drop_presence_list.sql +35 -0
  686. synapse/storage/schema/main/delta/54/relations.sql +46 -0
  687. synapse/storage/schema/main/delta/54/stats.sql +99 -0
  688. synapse/storage/schema/main/delta/54/stats2.sql +47 -0
  689. synapse/storage/schema/main/delta/55/access_token_expiry.sql +37 -0
  690. synapse/storage/schema/main/delta/55/track_threepid_validations.sql +50 -0
  691. synapse/storage/schema/main/delta/55/users_alter_deactivated.sql +38 -0
  692. synapse/storage/schema/main/delta/56/add_spans_to_device_lists.sql +39 -0
  693. synapse/storage/schema/main/delta/56/current_state_events_membership.sql +41 -0
  694. synapse/storage/schema/main/delta/56/current_state_events_membership_mk2.sql +43 -0
  695. synapse/storage/schema/main/delta/56/delete_keys_from_deleted_backups.sql +44 -0
  696. synapse/storage/schema/main/delta/56/destinations_failure_ts.sql +44 -0
  697. synapse/storage/schema/main/delta/56/destinations_retry_interval_type.sql.postgres +18 -0
  698. synapse/storage/schema/main/delta/56/device_stream_id_insert.sql +39 -0
  699. synapse/storage/schema/main/delta/56/devices_last_seen.sql +43 -0
  700. synapse/storage/schema/main/delta/56/drop_unused_event_tables.sql +39 -0
  701. synapse/storage/schema/main/delta/56/event_expiry.sql +40 -0
  702. synapse/storage/schema/main/delta/56/event_labels.sql +49 -0
  703. synapse/storage/schema/main/delta/56/event_labels_background_update.sql +36 -0
  704. synapse/storage/schema/main/delta/56/fix_room_keys_index.sql +37 -0
  705. synapse/storage/schema/main/delta/56/hidden_devices.sql +37 -0
  706. synapse/storage/schema/main/delta/56/hidden_devices_fix.sql.sqlite +42 -0
  707. synapse/storage/schema/main/delta/56/nuke_empty_communities_from_db.sql +48 -0
  708. synapse/storage/schema/main/delta/56/public_room_list_idx.sql +35 -0
  709. synapse/storage/schema/main/delta/56/redaction_censor.sql +35 -0
  710. synapse/storage/schema/main/delta/56/redaction_censor2.sql +41 -0
  711. synapse/storage/schema/main/delta/56/redaction_censor3_fix_update.sql.postgres +25 -0
  712. synapse/storage/schema/main/delta/56/redaction_censor4.sql +35 -0
  713. synapse/storage/schema/main/delta/56/remove_tombstoned_rooms_from_directory.sql +38 -0
  714. synapse/storage/schema/main/delta/56/room_key_etag.sql +36 -0
  715. synapse/storage/schema/main/delta/56/room_membership_idx.sql +37 -0
  716. synapse/storage/schema/main/delta/56/room_retention.sql +52 -0
  717. synapse/storage/schema/main/delta/56/signing_keys.sql +75 -0
  718. synapse/storage/schema/main/delta/56/signing_keys_nonunique_signatures.sql +41 -0
  719. synapse/storage/schema/main/delta/56/stats_separated.sql +175 -0
  720. synapse/storage/schema/main/delta/56/unique_user_filter_index.py +46 -0
  721. synapse/storage/schema/main/delta/56/user_external_ids.sql +43 -0
  722. synapse/storage/schema/main/delta/56/users_in_public_rooms_idx.sql +36 -0
  723. synapse/storage/schema/main/delta/57/delete_old_current_state_events.sql +41 -0
  724. synapse/storage/schema/main/delta/57/device_list_remote_cache_stale.sql +44 -0
  725. synapse/storage/schema/main/delta/57/local_current_membership.py +111 -0
  726. synapse/storage/schema/main/delta/57/remove_sent_outbound_pokes.sql +40 -0
  727. synapse/storage/schema/main/delta/57/rooms_version_column.sql +43 -0
  728. synapse/storage/schema/main/delta/57/rooms_version_column_2.sql.postgres +35 -0
  729. synapse/storage/schema/main/delta/57/rooms_version_column_2.sql.sqlite +22 -0
  730. synapse/storage/schema/main/delta/57/rooms_version_column_3.sql.postgres +39 -0
  731. synapse/storage/schema/main/delta/57/rooms_version_column_3.sql.sqlite +23 -0
  732. synapse/storage/schema/main/delta/58/02remove_dup_outbound_pokes.sql +41 -0
  733. synapse/storage/schema/main/delta/58/03persist_ui_auth.sql +55 -0
  734. synapse/storage/schema/main/delta/58/05cache_instance.sql.postgres +30 -0
  735. synapse/storage/schema/main/delta/58/06dlols_unique_idx.py +83 -0
  736. synapse/storage/schema/main/delta/58/07add_method_to_thumbnail_constraint.sql.postgres +33 -0
  737. synapse/storage/schema/main/delta/58/07add_method_to_thumbnail_constraint.sql.sqlite +44 -0
  738. synapse/storage/schema/main/delta/58/07persist_ui_auth_ips.sql +44 -0
  739. synapse/storage/schema/main/delta/58/08_media_safe_from_quarantine.sql.postgres +18 -0
  740. synapse/storage/schema/main/delta/58/08_media_safe_from_quarantine.sql.sqlite +18 -0
  741. synapse/storage/schema/main/delta/58/09shadow_ban.sql +37 -0
  742. synapse/storage/schema/main/delta/58/10_pushrules_enabled_delete_obsolete.sql +47 -0
  743. synapse/storage/schema/main/delta/58/10drop_local_rejections_stream.sql +41 -0
  744. synapse/storage/schema/main/delta/58/10federation_pos_instance_name.sql +41 -0
  745. synapse/storage/schema/main/delta/58/11dehydration.sql +39 -0
  746. synapse/storage/schema/main/delta/58/11fallback.sql +43 -0
  747. synapse/storage/schema/main/delta/58/11user_id_seq.py +38 -0
  748. synapse/storage/schema/main/delta/58/12room_stats.sql +51 -0
  749. synapse/storage/schema/main/delta/58/13remove_presence_allow_inbound.sql +36 -0
  750. synapse/storage/schema/main/delta/58/14events_instance_name.sql +35 -0
  751. synapse/storage/schema/main/delta/58/14events_instance_name.sql.postgres +28 -0
  752. synapse/storage/schema/main/delta/58/15_catchup_destination_rooms.sql +61 -0
  753. synapse/storage/schema/main/delta/58/15unread_count.sql +45 -0
  754. synapse/storage/schema/main/delta/58/16populate_stats_process_rooms_fix.sql +41 -0
  755. synapse/storage/schema/main/delta/58/17_catchup_last_successful.sql +40 -0
  756. synapse/storage/schema/main/delta/58/18stream_positions.sql +41 -0
  757. synapse/storage/schema/main/delta/58/19instance_map.sql.postgres +25 -0
  758. synapse/storage/schema/main/delta/58/19txn_id.sql +59 -0
  759. synapse/storage/schema/main/delta/58/20instance_name_event_tables.sql +36 -0
  760. synapse/storage/schema/main/delta/58/20user_daily_visits.sql +37 -0
  761. synapse/storage/schema/main/delta/58/21as_device_stream.sql +36 -0
  762. synapse/storage/schema/main/delta/58/21drop_device_max_stream_id.sql +1 -0
  763. synapse/storage/schema/main/delta/58/22puppet_token.sql +36 -0
  764. synapse/storage/schema/main/delta/58/22users_have_local_media.sql +2 -0
  765. synapse/storage/schema/main/delta/58/23e2e_cross_signing_keys_idx.sql +36 -0
  766. synapse/storage/schema/main/delta/58/24drop_event_json_index.sql +38 -0
  767. synapse/storage/schema/main/delta/58/25user_external_ids_user_id_idx.sql +36 -0
  768. synapse/storage/schema/main/delta/58/26access_token_last_validated.sql +37 -0
  769. synapse/storage/schema/main/delta/58/27local_invites.sql +37 -0
  770. synapse/storage/schema/main/delta/58/28drop_last_used_column.sql.postgres +16 -0
  771. synapse/storage/schema/main/delta/58/28drop_last_used_column.sql.sqlite +62 -0
  772. synapse/storage/schema/main/delta/59/01ignored_user.py +85 -0
  773. synapse/storage/schema/main/delta/59/02shard_send_to_device.sql +37 -0
  774. synapse/storage/schema/main/delta/59/03shard_send_to_device_sequence.sql.postgres +25 -0
  775. synapse/storage/schema/main/delta/59/04_event_auth_chains.sql +71 -0
  776. synapse/storage/schema/main/delta/59/04_event_auth_chains.sql.postgres +16 -0
  777. synapse/storage/schema/main/delta/59/04drop_account_data.sql +36 -0
  778. synapse/storage/schema/main/delta/59/05cache_invalidation.sql +36 -0
  779. synapse/storage/schema/main/delta/59/06chain_cover_index.sql +36 -0
  780. synapse/storage/schema/main/delta/59/06shard_account_data.sql +39 -0
  781. synapse/storage/schema/main/delta/59/06shard_account_data.sql.postgres +32 -0
  782. synapse/storage/schema/main/delta/59/07shard_account_data_fix.sql +37 -0
  783. synapse/storage/schema/main/delta/59/08delete_pushers_for_deactivated_accounts.sql +39 -0
  784. synapse/storage/schema/main/delta/59/08delete_stale_pushers.sql +39 -0
  785. synapse/storage/schema/main/delta/59/09rejected_events_metadata.sql +45 -0
  786. synapse/storage/schema/main/delta/59/10delete_purged_chain_cover.sql +36 -0
  787. synapse/storage/schema/main/delta/59/11add_knock_members_to_stats.sql +39 -0
  788. synapse/storage/schema/main/delta/59/11drop_thumbnail_constraint.sql.postgres +22 -0
  789. synapse/storage/schema/main/delta/59/12account_validity_token_used_ts_ms.sql +37 -0
  790. synapse/storage/schema/main/delta/59/12presence_stream_instance.sql +37 -0
  791. synapse/storage/schema/main/delta/59/12presence_stream_instance_seq.sql.postgres +20 -0
  792. synapse/storage/schema/main/delta/59/13users_to_send_full_presence_to.sql +53 -0
  793. synapse/storage/schema/main/delta/59/14refresh_tokens.sql +53 -0
  794. synapse/storage/schema/main/delta/59/15locks.sql +56 -0
  795. synapse/storage/schema/main/delta/59/16federation_inbound_staging.sql +51 -0
  796. synapse/storage/schema/main/delta/60/01recreate_stream_ordering.sql.postgres +45 -0
  797. synapse/storage/schema/main/delta/60/02change_stream_ordering_columns.sql.postgres +30 -0
  798. synapse/storage/schema/main/delta/61/01change_appservices_txns.sql.postgres +23 -0
  799. synapse/storage/schema/main/delta/61/01insertion_event_lookups.sql +68 -0
  800. synapse/storage/schema/main/delta/61/02drop_redundant_room_depth_index.sql +37 -0
  801. synapse/storage/schema/main/delta/61/03recreate_min_depth.py +74 -0
  802. synapse/storage/schema/main/delta/62/01insertion_event_extremities.sql +43 -0
  803. synapse/storage/schema/main/delta/63/01create_registration_tokens.sql +42 -0
  804. synapse/storage/schema/main/delta/63/02delete_unlinked_email_pushers.sql +39 -0
  805. synapse/storage/schema/main/delta/63/02populate-rooms-creator.sql +36 -0
  806. synapse/storage/schema/main/delta/63/03session_store.sql +42 -0
  807. synapse/storage/schema/main/delta/63/04add_presence_stream_not_offline_index.sql +37 -0
  808. synapse/storage/schema/main/delta/64/01msc2716_chunk_to_batch_rename.sql.postgres +23 -0
  809. synapse/storage/schema/main/delta/64/01msc2716_chunk_to_batch_rename.sql.sqlite +37 -0
  810. synapse/storage/schema/main/delta/65/01msc2716_insertion_event_edges.sql +38 -0
  811. synapse/storage/schema/main/delta/65/03remove_hidden_devices_from_device_inbox.sql +41 -0
  812. synapse/storage/schema/main/delta/65/04_local_group_updates.sql +37 -0
  813. synapse/storage/schema/main/delta/65/05_remove_room_stats_historical_and_user_stats_historical.sql +38 -0
  814. synapse/storage/schema/main/delta/65/06remove_deleted_devices_from_device_inbox.sql +53 -0
  815. synapse/storage/schema/main/delta/65/07_arbitrary_relations.sql +37 -0
  816. synapse/storage/schema/main/delta/65/08_device_inbox_background_updates.sql +37 -0
  817. synapse/storage/schema/main/delta/65/10_expirable_refresh_tokens.sql +47 -0
  818. synapse/storage/schema/main/delta/65/11_devices_auth_provider_session.sql +46 -0
  819. synapse/storage/schema/main/delta/67/01drop_public_room_list_stream.sql +37 -0
  820. synapse/storage/schema/main/delta/68/01event_columns.sql +45 -0
  821. synapse/storage/schema/main/delta/68/02_msc2409_add_device_id_appservice_stream_type.sql +40 -0
  822. synapse/storage/schema/main/delta/68/03_delete_account_data_for_deactivated_accounts.sql +39 -0
  823. synapse/storage/schema/main/delta/68/04_refresh_tokens_index_next_token_id.sql +47 -0
  824. synapse/storage/schema/main/delta/68/04partial_state_rooms.sql +60 -0
  825. synapse/storage/schema/main/delta/68/05_delete_non_strings_from_event_search.sql.sqlite +22 -0
  826. synapse/storage/schema/main/delta/68/05partial_state_rooms_triggers.py +80 -0
  827. synapse/storage/schema/main/delta/68/06_msc3202_add_device_list_appservice_stream_type.sql +42 -0
  828. synapse/storage/schema/main/delta/69/01as_txn_seq.py +54 -0
  829. synapse/storage/schema/main/delta/69/01device_list_oubound_by_room.sql +57 -0
  830. synapse/storage/schema/main/delta/69/02cache_invalidation_index.sql +37 -0
  831. synapse/storage/schema/main/delta/70/01clean_table_purged_rooms.sql +39 -0
  832. synapse/storage/schema/main/delta/71/01rebuild_event_edges.sql.postgres +43 -0
  833. synapse/storage/schema/main/delta/71/01rebuild_event_edges.sql.sqlite +47 -0
  834. synapse/storage/schema/main/delta/71/01remove_noop_background_updates.sql +80 -0
  835. synapse/storage/schema/main/delta/71/02event_push_summary_unique.sql +37 -0
  836. synapse/storage/schema/main/delta/72/01add_room_type_to_state_stats.sql +38 -0
  837. synapse/storage/schema/main/delta/72/01event_push_summary_receipt.sql +54 -0
  838. synapse/storage/schema/main/delta/72/02event_push_actions_index.sql +38 -0
  839. synapse/storage/schema/main/delta/72/03bg_populate_events_columns.py +57 -0
  840. synapse/storage/schema/main/delta/72/03drop_event_reference_hashes.sql +36 -0
  841. synapse/storage/schema/main/delta/72/03remove_groups.sql +50 -0
  842. synapse/storage/schema/main/delta/72/04drop_column_application_services_state_last_txn.sql.postgres +17 -0
  843. synapse/storage/schema/main/delta/72/04drop_column_application_services_state_last_txn.sql.sqlite +40 -0
  844. synapse/storage/schema/main/delta/72/05receipts_event_stream_ordering.sql +38 -0
  845. synapse/storage/schema/main/delta/72/05remove_unstable_private_read_receipts.sql +38 -0
  846. synapse/storage/schema/main/delta/72/06add_consent_ts_to_users.sql +35 -0
  847. synapse/storage/schema/main/delta/72/06thread_notifications.sql +49 -0
  848. synapse/storage/schema/main/delta/72/07force_update_current_state_events_membership.py +67 -0
  849. synapse/storage/schema/main/delta/72/07thread_receipts.sql.postgres +30 -0
  850. synapse/storage/schema/main/delta/72/07thread_receipts.sql.sqlite +70 -0
  851. synapse/storage/schema/main/delta/72/08begin_cache_invalidation_seq_at_2.sql.postgres +23 -0
  852. synapse/storage/schema/main/delta/72/08thread_receipts.sql +39 -0
  853. synapse/storage/schema/main/delta/72/09partial_indices.sql.sqlite +56 -0
  854. synapse/storage/schema/main/delta/73/01event_failed_pull_attempts.sql +48 -0
  855. synapse/storage/schema/main/delta/73/02add_pusher_enabled.sql +35 -0
  856. synapse/storage/schema/main/delta/73/02room_id_indexes_for_purging.sql +41 -0
  857. synapse/storage/schema/main/delta/73/03pusher_device_id.sql +39 -0
  858. synapse/storage/schema/main/delta/73/03users_approved_column.sql +39 -0
  859. synapse/storage/schema/main/delta/73/04partial_join_details.sql +42 -0
  860. synapse/storage/schema/main/delta/73/04pending_device_list_updates.sql +47 -0
  861. synapse/storage/schema/main/delta/73/05old_push_actions.sql.postgres +22 -0
  862. synapse/storage/schema/main/delta/73/05old_push_actions.sql.sqlite +24 -0
  863. synapse/storage/schema/main/delta/73/06thread_notifications_thread_id_idx.sql +42 -0
  864. synapse/storage/schema/main/delta/73/08thread_receipts_non_null.sql.postgres +23 -0
  865. synapse/storage/schema/main/delta/73/08thread_receipts_non_null.sql.sqlite +76 -0
  866. synapse/storage/schema/main/delta/73/09partial_joined_via_destination.sql +37 -0
  867. synapse/storage/schema/main/delta/73/09threads_table.sql +49 -0
  868. synapse/storage/schema/main/delta/73/10_update_sqlite_fts4_tokenizer.py +71 -0
  869. synapse/storage/schema/main/delta/73/10login_tokens.sql +54 -0
  870. synapse/storage/schema/main/delta/73/11event_search_room_id_n_distinct.sql.postgres +33 -0
  871. synapse/storage/schema/main/delta/73/12refactor_device_list_outbound_pokes.sql +72 -0
  872. synapse/storage/schema/main/delta/73/13add_device_lists_index.sql +39 -0
  873. synapse/storage/schema/main/delta/73/20_un_partial_stated_room_stream.sql +51 -0
  874. synapse/storage/schema/main/delta/73/21_un_partial_stated_room_stream_seq.sql.postgres +20 -0
  875. synapse/storage/schema/main/delta/73/22_rebuild_user_dir_stats.sql +48 -0
  876. synapse/storage/schema/main/delta/73/22_un_partial_stated_event_stream.sql +53 -0
  877. synapse/storage/schema/main/delta/73/23_fix_thread_index.sql +52 -0
  878. synapse/storage/schema/main/delta/73/23_un_partial_stated_room_stream_seq.sql.postgres +20 -0
  879. synapse/storage/schema/main/delta/73/24_events_jump_to_date_index.sql +36 -0
  880. synapse/storage/schema/main/delta/73/25drop_presence.sql +36 -0
  881. synapse/storage/schema/main/delta/74/01_user_directory_stale_remote_users.sql +58 -0
  882. synapse/storage/schema/main/delta/74/02_set_device_id_for_pushers_bg_update.sql +38 -0
  883. synapse/storage/schema/main/delta/74/03_membership_tables_event_stream_ordering.sql.postgres +29 -0
  884. synapse/storage/schema/main/delta/74/03_membership_tables_event_stream_ordering.sql.sqlite +23 -0
  885. synapse/storage/schema/main/delta/74/03_room_membership_index.sql +38 -0
  886. synapse/storage/schema/main/delta/74/04_delete_e2e_backup_keys_for_deactivated_users.sql +36 -0
  887. synapse/storage/schema/main/delta/74/04_membership_tables_event_stream_ordering_triggers.py +87 -0
  888. synapse/storage/schema/main/delta/74/05_events_txn_id_device_id.sql +72 -0
  889. synapse/storage/schema/main/delta/74/90COMMENTS_destinations.sql.postgres +52 -0
  890. synapse/storage/schema/main/delta/76/01_add_profiles_full_user_id_column.sql +39 -0
  891. synapse/storage/schema/main/delta/76/02_add_user_filters_full_user_id_column.sql +39 -0
  892. synapse/storage/schema/main/delta/76/03_per_user_experimental_features.sql +46 -0
  893. synapse/storage/schema/main/delta/76/04_add_room_forgetter.sql +43 -0
  894. synapse/storage/schema/main/delta/77/01_add_profiles_not_valid_check.sql.postgres +16 -0
  895. synapse/storage/schema/main/delta/77/02_add_user_filters_not_valid_check.sql.postgres +16 -0
  896. synapse/storage/schema/main/delta/77/03bg_populate_full_user_id_profiles.sql +35 -0
  897. synapse/storage/schema/main/delta/77/04bg_populate_full_user_id_user_filters.sql +35 -0
  898. synapse/storage/schema/main/delta/77/05thread_notifications_backfill.sql +67 -0
  899. synapse/storage/schema/main/delta/77/06thread_notifications_not_null.sql.sqlite +102 -0
  900. synapse/storage/schema/main/delta/77/06thread_notifications_not_null_event_push_actions.sql.postgres +27 -0
  901. synapse/storage/schema/main/delta/77/06thread_notifications_not_null_event_push_actions_staging.sql.postgres +27 -0
  902. synapse/storage/schema/main/delta/77/06thread_notifications_not_null_event_push_summary.sql.postgres +29 -0
  903. synapse/storage/schema/main/delta/77/14bg_indices_event_stream_ordering.sql +39 -0
  904. synapse/storage/schema/main/delta/78/01_validate_and_update_profiles.py +99 -0
  905. synapse/storage/schema/main/delta/78/02_validate_and_update_user_filters.py +100 -0
  906. synapse/storage/schema/main/delta/78/03_remove_unused_indexes_user_filters.py +72 -0
  907. synapse/storage/schema/main/delta/78/03event_extremities_constraints.py +65 -0
  908. synapse/storage/schema/main/delta/78/04_add_full_user_id_index_user_filters.py +32 -0
  909. synapse/storage/schema/main/delta/79/03_read_write_locks_triggers.sql.postgres +102 -0
  910. synapse/storage/schema/main/delta/79/03_read_write_locks_triggers.sql.sqlite +72 -0
  911. synapse/storage/schema/main/delta/79/04_mitigate_stream_ordering_update_race.py +70 -0
  912. synapse/storage/schema/main/delta/79/05_read_write_locks_triggers.sql.postgres +69 -0
  913. synapse/storage/schema/main/delta/79/05_read_write_locks_triggers.sql.sqlite +65 -0
  914. synapse/storage/schema/main/delta/80/01_users_alter_locked.sql +35 -0
  915. synapse/storage/schema/main/delta/80/02_read_write_locks_unlogged.sql.postgres +30 -0
  916. synapse/storage/schema/main/delta/80/02_scheduled_tasks.sql +47 -0
  917. synapse/storage/schema/main/delta/80/03_read_write_locks_triggers.sql.postgres +37 -0
  918. synapse/storage/schema/main/delta/80/04_read_write_locks_deadlock.sql.postgres +71 -0
  919. synapse/storage/schema/main/delta/82/02_scheduled_tasks_index.sql +35 -0
  920. synapse/storage/schema/main/delta/82/04_add_indices_for_purging_rooms.sql +39 -0
  921. synapse/storage/schema/main/delta/82/05gaps.sql +44 -0
  922. synapse/storage/schema/main/delta/83/01_drop_old_tables.sql +43 -0
  923. synapse/storage/schema/main/delta/83/03_instance_name_receipts.sql.sqlite +17 -0
  924. synapse/storage/schema/main/delta/83/05_cross_signing_key_update_grant.sql +34 -0
  925. synapse/storage/schema/main/delta/83/06_event_push_summary_room.sql +36 -0
  926. synapse/storage/schema/main/delta/84/01_auth_links_stats.sql.postgres +20 -0
  927. synapse/storage/schema/main/delta/84/02_auth_links_index.sql +16 -0
  928. synapse/storage/schema/main/delta/84/03_auth_links_analyze.sql.postgres +16 -0
  929. synapse/storage/schema/main/delta/84/04_access_token_index.sql +15 -0
  930. synapse/storage/schema/main/delta/85/01_add_suspended.sql +14 -0
  931. synapse/storage/schema/main/delta/85/02_add_instance_names.sql +27 -0
  932. synapse/storage/schema/main/delta/85/03_new_sequences.sql.postgres +54 -0
  933. synapse/storage/schema/main/delta/85/04_cleanup_device_federation_outbox.sql +15 -0
  934. synapse/storage/schema/main/delta/85/05_add_instance_names_converted_pos.sql +16 -0
  935. synapse/storage/schema/main/delta/85/06_add_room_reports.sql +20 -0
  936. synapse/storage/schema/main/delta/86/01_authenticate_media.sql +15 -0
  937. synapse/storage/schema/main/delta/86/02_receipts_event_id_index.sql +15 -0
  938. synapse/storage/schema/main/delta/87/01_sliding_sync_memberships.sql +169 -0
  939. synapse/storage/schema/main/delta/87/02_per_connection_state.sql +81 -0
  940. synapse/storage/schema/main/delta/87/03_current_state_index.sql +19 -0
  941. synapse/storage/schema/main/delta/88/01_add_delayed_events.sql +43 -0
  942. synapse/storage/schema/main/delta/88/01_custom_profile_fields.sql +15 -0
  943. synapse/storage/schema/main/delta/88/02_fix_sliding_sync_membership_snapshots_forgotten_column.sql +21 -0
  944. synapse/storage/schema/main/delta/88/03_add_otk_ts_added_index.sql +18 -0
  945. synapse/storage/schema/main/delta/88/04_current_state_delta_index.sql +18 -0
  946. synapse/storage/schema/main/delta/88/05_drop_old_otks.sql.postgres +19 -0
  947. synapse/storage/schema/main/delta/88/05_drop_old_otks.sql.sqlite +19 -0
  948. synapse/storage/schema/main/delta/88/05_sliding_sync_room_config_index.sql +20 -0
  949. synapse/storage/schema/main/delta/88/06_events_received_ts_index.sql +17 -0
  950. synapse/storage/schema/main/delta/89/01_sliding_sync_membership_snapshot_index.sql +15 -0
  951. synapse/storage/schema/main/delta/90/01_add_column_participant_room_memberships_table.sql +16 -0
  952. synapse/storage/schema/main/delta/91/01_media_hash.sql +28 -0
  953. synapse/storage/schema/main/delta/92/01_remove_trigger.sql.postgres +16 -0
  954. synapse/storage/schema/main/delta/92/01_remove_trigger.sql.sqlite +16 -0
  955. synapse/storage/schema/main/delta/92/02_remove_populate_participant_bg_update.sql +17 -0
  956. synapse/storage/schema/main/delta/92/04_ss_membership_snapshot_idx.sql +16 -0
  957. synapse/storage/schema/main/delta/92/04_thread_subscriptions.sql +59 -0
  958. synapse/storage/schema/main/delta/92/04_thread_subscriptions_seq.sql.postgres +19 -0
  959. synapse/storage/schema/main/delta/92/05_fixup_max_depth_cap.sql +17 -0
  960. synapse/storage/schema/main/delta/92/05_thread_subscriptions_comments.sql.postgres +18 -0
  961. synapse/storage/schema/main/delta/92/06_device_federation_inbox_index.sql +16 -0
  962. synapse/storage/schema/main/delta/92/06_threads_last_sent_stream_ordering_comments.sql.postgres +24 -0
  963. synapse/storage/schema/main/delta/92/07_add_user_reports.sql +22 -0
  964. synapse/storage/schema/main/delta/92/07_event_txn_id_device_id_txn_id2.sql +15 -0
  965. synapse/storage/schema/main/delta/92/08_room_ban_redactions.sql +21 -0
  966. synapse/storage/schema/main/delta/92/08_thread_subscriptions_seq_fixup.sql.postgres +19 -0
  967. synapse/storage/schema/main/delta/92/09_thread_subscriptions_update.sql +20 -0
  968. synapse/storage/schema/main/delta/92/09_thread_subscriptions_update.sql.postgres +18 -0
  969. synapse/storage/schema/main/full_schemas/72/full.sql.postgres +1344 -0
  970. synapse/storage/schema/main/full_schemas/72/full.sql.sqlite +646 -0
  971. synapse/storage/schema/state/delta/23/drop_state_index.sql +35 -0
  972. synapse/storage/schema/state/delta/32/remove_state_indices.sql +38 -0
  973. synapse/storage/schema/state/delta/35/add_state_index.sql +36 -0
  974. synapse/storage/schema/state/delta/35/state.sql +41 -0
  975. synapse/storage/schema/state/delta/35/state_dedupe.sql +36 -0
  976. synapse/storage/schema/state/delta/47/state_group_seq.py +38 -0
  977. synapse/storage/schema/state/delta/56/state_group_room_idx.sql +36 -0
  978. synapse/storage/schema/state/delta/61/02state_groups_state_n_distinct.sql.postgres +34 -0
  979. synapse/storage/schema/state/delta/70/08_state_group_edges_unique.sql +36 -0
  980. synapse/storage/schema/state/delta/89/01_state_groups_deletion.sql +39 -0
  981. synapse/storage/schema/state/delta/90/02_delete_unreferenced_state_groups.sql +16 -0
  982. synapse/storage/schema/state/delta/90/03_remove_old_deletion_bg_update.sql +15 -0
  983. synapse/storage/schema/state/full_schemas/72/full.sql.postgres +30 -0
  984. synapse/storage/schema/state/full_schemas/72/full.sql.sqlite +20 -0
  985. synapse/storage/types.py +185 -0
  986. synapse/storage/util/__init__.py +20 -0
  987. synapse/storage/util/id_generators.py +909 -0
  988. synapse/storage/util/partial_state_events_tracker.py +194 -0
  989. synapse/storage/util/sequence.py +315 -0
  990. synapse/streams/__init__.py +43 -0
  991. synapse/streams/config.py +92 -0
  992. synapse/streams/events.py +203 -0
  993. synapse/synapse_rust/__init__.pyi +3 -0
  994. synapse/synapse_rust/acl.pyi +20 -0
  995. synapse/synapse_rust/events.pyi +136 -0
  996. synapse/synapse_rust/http_client.pyi +32 -0
  997. synapse/synapse_rust/push.pyi +86 -0
  998. synapse/synapse_rust/rendezvous.pyi +30 -0
  999. synapse/synapse_rust/segmenter.pyi +1 -0
  1000. synapse/synapse_rust.abi3.so +0 -0
  1001. synapse/types/__init__.py +1600 -0
  1002. synapse/types/handlers/__init__.py +93 -0
  1003. synapse/types/handlers/policy_server.py +16 -0
  1004. synapse/types/handlers/sliding_sync.py +909 -0
  1005. synapse/types/rest/__init__.py +25 -0
  1006. synapse/types/rest/client/__init__.py +415 -0
  1007. synapse/types/state.py +635 -0
  1008. synapse/types/storage/__init__.py +66 -0
  1009. synapse/util/__init__.py +170 -0
  1010. synapse/util/async_helpers.py +1067 -0
  1011. synapse/util/batching_queue.py +202 -0
  1012. synapse/util/caches/__init__.py +300 -0
  1013. synapse/util/caches/cached_call.py +143 -0
  1014. synapse/util/caches/deferred_cache.py +530 -0
  1015. synapse/util/caches/descriptors.py +694 -0
  1016. synapse/util/caches/dictionary_cache.py +350 -0
  1017. synapse/util/caches/expiringcache.py +251 -0
  1018. synapse/util/caches/lrucache.py +977 -0
  1019. synapse/util/caches/response_cache.py +323 -0
  1020. synapse/util/caches/stream_change_cache.py +370 -0
  1021. synapse/util/caches/treecache.py +189 -0
  1022. synapse/util/caches/ttlcache.py +197 -0
  1023. synapse/util/cancellation.py +63 -0
  1024. synapse/util/check_dependencies.py +335 -0
  1025. synapse/util/clock.py +500 -0
  1026. synapse/util/constants.py +22 -0
  1027. synapse/util/daemonize.py +165 -0
  1028. synapse/util/distributor.py +159 -0
  1029. synapse/util/events.py +134 -0
  1030. synapse/util/file_consumer.py +164 -0
  1031. synapse/util/frozenutils.py +57 -0
  1032. synapse/util/gai_resolver.py +180 -0
  1033. synapse/util/hash.py +38 -0
  1034. synapse/util/httpresourcetree.py +108 -0
  1035. synapse/util/iterutils.py +189 -0
  1036. synapse/util/json.py +56 -0
  1037. synapse/util/linked_list.py +156 -0
  1038. synapse/util/logcontext.py +46 -0
  1039. synapse/util/logformatter.py +28 -0
  1040. synapse/util/macaroons.py +325 -0
  1041. synapse/util/manhole.py +191 -0
  1042. synapse/util/metrics.py +340 -0
  1043. synapse/util/module_loader.py +116 -0
  1044. synapse/util/msisdn.py +51 -0
  1045. synapse/util/patch_inline_callbacks.py +250 -0
  1046. synapse/util/pydantic_models.py +56 -0
  1047. synapse/util/ratelimitutils.py +420 -0
  1048. synapse/util/retryutils.py +339 -0
  1049. synapse/util/rlimit.py +42 -0
  1050. synapse/util/rust.py +134 -0
  1051. synapse/util/sentinel.py +21 -0
  1052. synapse/util/stringutils.py +293 -0
  1053. synapse/util/task_scheduler.py +493 -0
  1054. synapse/util/templates.py +126 -0
  1055. synapse/util/threepids.py +123 -0
  1056. synapse/util/wheel_timer.py +112 -0
  1057. synapse/visibility.py +836 -0
@@ -0,0 +1,1344 @@
1
+ CREATE FUNCTION check_partial_state_events() RETURNS trigger
2
+ LANGUAGE plpgsql
3
+ AS $$
4
+ BEGIN
5
+ IF EXISTS (
6
+ SELECT 1 FROM events
7
+ WHERE events.event_id = NEW.event_id
8
+ AND events.room_id != NEW.room_id
9
+ ) THEN
10
+ RAISE EXCEPTION 'Incorrect room_id in partial_state_events';
11
+ END IF;
12
+ RETURN NEW;
13
+ END;
14
+ $$;
15
+ CREATE TABLE access_tokens (
16
+ id bigint NOT NULL,
17
+ user_id text NOT NULL,
18
+ device_id text,
19
+ token text NOT NULL,
20
+ valid_until_ms bigint,
21
+ puppets_user_id text,
22
+ last_validated bigint,
23
+ refresh_token_id bigint,
24
+ used boolean
25
+ );
26
+ CREATE TABLE account_data (
27
+ user_id text NOT NULL,
28
+ account_data_type text NOT NULL,
29
+ stream_id bigint NOT NULL,
30
+ content text NOT NULL,
31
+ instance_name text
32
+ );
33
+ CREATE SEQUENCE account_data_sequence
34
+ START WITH 1
35
+ INCREMENT BY 1
36
+ NO MINVALUE
37
+ NO MAXVALUE
38
+ CACHE 1;
39
+ CREATE TABLE account_validity (
40
+ user_id text NOT NULL,
41
+ expiration_ts_ms bigint NOT NULL,
42
+ email_sent boolean NOT NULL,
43
+ renewal_token text,
44
+ token_used_ts_ms bigint
45
+ );
46
+ CREATE TABLE application_services_state (
47
+ as_id text NOT NULL,
48
+ state character varying(5),
49
+ read_receipt_stream_id bigint,
50
+ presence_stream_id bigint,
51
+ to_device_stream_id bigint,
52
+ device_list_stream_id bigint
53
+ );
54
+ CREATE SEQUENCE application_services_txn_id_seq
55
+ START WITH 1
56
+ INCREMENT BY 1
57
+ NO MINVALUE
58
+ NO MAXVALUE
59
+ CACHE 1;
60
+ CREATE TABLE application_services_txns (
61
+ as_id text NOT NULL,
62
+ txn_id bigint NOT NULL,
63
+ event_ids text NOT NULL
64
+ );
65
+ CREATE TABLE appservice_room_list (
66
+ appservice_id text NOT NULL,
67
+ network_id text NOT NULL,
68
+ room_id text NOT NULL
69
+ );
70
+ CREATE TABLE appservice_stream_position (
71
+ lock character(1) DEFAULT 'X'::bpchar NOT NULL,
72
+ stream_ordering bigint,
73
+ CONSTRAINT appservice_stream_position_lock_check CHECK ((lock = 'X'::bpchar))
74
+ );
75
+ CREATE TABLE batch_events (
76
+ event_id text NOT NULL,
77
+ room_id text NOT NULL,
78
+ batch_id text NOT NULL
79
+ );
80
+ CREATE TABLE blocked_rooms (
81
+ room_id text NOT NULL,
82
+ user_id text NOT NULL
83
+ );
84
+ CREATE TABLE cache_invalidation_stream_by_instance (
85
+ stream_id bigint NOT NULL,
86
+ instance_name text NOT NULL,
87
+ cache_func text NOT NULL,
88
+ keys text[],
89
+ invalidation_ts bigint
90
+ );
91
+ CREATE SEQUENCE cache_invalidation_stream_seq
92
+ START WITH 1
93
+ INCREMENT BY 1
94
+ NO MINVALUE
95
+ NO MAXVALUE
96
+ CACHE 1;
97
+ CREATE TABLE current_state_delta_stream (
98
+ stream_id bigint NOT NULL,
99
+ room_id text NOT NULL,
100
+ type text NOT NULL,
101
+ state_key text NOT NULL,
102
+ event_id text,
103
+ prev_event_id text,
104
+ instance_name text
105
+ );
106
+ CREATE TABLE current_state_events (
107
+ event_id text NOT NULL,
108
+ room_id text NOT NULL,
109
+ type text NOT NULL,
110
+ state_key text NOT NULL,
111
+ membership text
112
+ );
113
+ CREATE TABLE dehydrated_devices (
114
+ user_id text NOT NULL,
115
+ device_id text NOT NULL,
116
+ device_data text NOT NULL
117
+ );
118
+ CREATE TABLE deleted_pushers (
119
+ stream_id bigint NOT NULL,
120
+ app_id text NOT NULL,
121
+ pushkey text NOT NULL,
122
+ user_id text NOT NULL
123
+ );
124
+ CREATE TABLE destination_rooms (
125
+ destination text NOT NULL,
126
+ room_id text NOT NULL,
127
+ stream_ordering bigint NOT NULL
128
+ );
129
+ CREATE TABLE destinations (
130
+ destination text NOT NULL,
131
+ retry_last_ts bigint,
132
+ retry_interval bigint,
133
+ failure_ts bigint,
134
+ last_successful_stream_ordering bigint
135
+ );
136
+ CREATE TABLE device_auth_providers (
137
+ user_id text NOT NULL,
138
+ device_id text NOT NULL,
139
+ auth_provider_id text NOT NULL,
140
+ auth_provider_session_id text NOT NULL
141
+ );
142
+ CREATE TABLE device_federation_inbox (
143
+ origin text NOT NULL,
144
+ message_id text NOT NULL,
145
+ received_ts bigint NOT NULL,
146
+ instance_name text
147
+ );
148
+ CREATE TABLE device_federation_outbox (
149
+ destination text NOT NULL,
150
+ stream_id bigint NOT NULL,
151
+ queued_ts bigint NOT NULL,
152
+ messages_json text NOT NULL,
153
+ instance_name text
154
+ );
155
+ CREATE TABLE device_inbox (
156
+ user_id text NOT NULL,
157
+ device_id text NOT NULL,
158
+ stream_id bigint NOT NULL,
159
+ message_json text NOT NULL,
160
+ instance_name text
161
+ );
162
+ CREATE SEQUENCE device_inbox_sequence
163
+ START WITH 1
164
+ INCREMENT BY 1
165
+ NO MINVALUE
166
+ NO MAXVALUE
167
+ CACHE 1;
168
+ CREATE TABLE device_lists_changes_in_room (
169
+ user_id text NOT NULL,
170
+ device_id text NOT NULL,
171
+ room_id text NOT NULL,
172
+ stream_id bigint NOT NULL,
173
+ converted_to_destinations boolean NOT NULL,
174
+ opentracing_context text
175
+ );
176
+ CREATE TABLE device_lists_outbound_last_success (
177
+ destination text NOT NULL,
178
+ user_id text NOT NULL,
179
+ stream_id bigint NOT NULL
180
+ );
181
+ CREATE TABLE device_lists_outbound_pokes (
182
+ destination text NOT NULL,
183
+ stream_id bigint NOT NULL,
184
+ user_id text NOT NULL,
185
+ device_id text NOT NULL,
186
+ sent boolean NOT NULL,
187
+ ts bigint NOT NULL,
188
+ opentracing_context text
189
+ );
190
+ CREATE TABLE device_lists_remote_cache (
191
+ user_id text NOT NULL,
192
+ device_id text NOT NULL,
193
+ content text NOT NULL
194
+ );
195
+ CREATE TABLE device_lists_remote_extremeties (
196
+ user_id text NOT NULL,
197
+ stream_id text NOT NULL
198
+ );
199
+ CREATE TABLE device_lists_remote_resync (
200
+ user_id text NOT NULL,
201
+ added_ts bigint NOT NULL
202
+ );
203
+ CREATE TABLE device_lists_stream (
204
+ stream_id bigint NOT NULL,
205
+ user_id text NOT NULL,
206
+ device_id text NOT NULL
207
+ );
208
+ CREATE TABLE devices (
209
+ user_id text NOT NULL,
210
+ device_id text NOT NULL,
211
+ display_name text,
212
+ last_seen bigint,
213
+ ip text,
214
+ user_agent text,
215
+ hidden boolean DEFAULT false
216
+ );
217
+ CREATE TABLE e2e_cross_signing_keys (
218
+ user_id text NOT NULL,
219
+ keytype text NOT NULL,
220
+ keydata text NOT NULL,
221
+ stream_id bigint NOT NULL
222
+ );
223
+ CREATE TABLE e2e_cross_signing_signatures (
224
+ user_id text NOT NULL,
225
+ key_id text NOT NULL,
226
+ target_user_id text NOT NULL,
227
+ target_device_id text NOT NULL,
228
+ signature text NOT NULL
229
+ );
230
+ CREATE TABLE e2e_device_keys_json (
231
+ user_id text NOT NULL,
232
+ device_id text NOT NULL,
233
+ ts_added_ms bigint NOT NULL,
234
+ key_json text NOT NULL
235
+ );
236
+ CREATE TABLE e2e_fallback_keys_json (
237
+ user_id text NOT NULL,
238
+ device_id text NOT NULL,
239
+ algorithm text NOT NULL,
240
+ key_id text NOT NULL,
241
+ key_json text NOT NULL,
242
+ used boolean DEFAULT false NOT NULL
243
+ );
244
+ CREATE TABLE e2e_one_time_keys_json (
245
+ user_id text NOT NULL,
246
+ device_id text NOT NULL,
247
+ algorithm text NOT NULL,
248
+ key_id text NOT NULL,
249
+ ts_added_ms bigint NOT NULL,
250
+ key_json text NOT NULL
251
+ );
252
+ CREATE TABLE e2e_room_keys (
253
+ user_id text NOT NULL,
254
+ room_id text NOT NULL,
255
+ session_id text NOT NULL,
256
+ version bigint NOT NULL,
257
+ first_message_index integer,
258
+ forwarded_count integer,
259
+ is_verified boolean,
260
+ session_data text NOT NULL
261
+ );
262
+ CREATE TABLE e2e_room_keys_versions (
263
+ user_id text NOT NULL,
264
+ version bigint NOT NULL,
265
+ algorithm text NOT NULL,
266
+ auth_data text NOT NULL,
267
+ deleted smallint DEFAULT 0 NOT NULL,
268
+ etag bigint
269
+ );
270
+ CREATE TABLE erased_users (
271
+ user_id text NOT NULL
272
+ );
273
+ CREATE TABLE event_auth (
274
+ event_id text NOT NULL,
275
+ auth_id text NOT NULL,
276
+ room_id text NOT NULL
277
+ );
278
+ CREATE SEQUENCE event_auth_chain_id
279
+ START WITH 1
280
+ INCREMENT BY 1
281
+ NO MINVALUE
282
+ NO MAXVALUE
283
+ CACHE 1;
284
+ CREATE TABLE event_auth_chain_links (
285
+ origin_chain_id bigint NOT NULL,
286
+ origin_sequence_number bigint NOT NULL,
287
+ target_chain_id bigint NOT NULL,
288
+ target_sequence_number bigint NOT NULL
289
+ );
290
+ CREATE TABLE event_auth_chain_to_calculate (
291
+ event_id text NOT NULL,
292
+ room_id text NOT NULL,
293
+ type text NOT NULL,
294
+ state_key text NOT NULL
295
+ );
296
+ CREATE TABLE event_auth_chains (
297
+ event_id text NOT NULL,
298
+ chain_id bigint NOT NULL,
299
+ sequence_number bigint NOT NULL
300
+ );
301
+ CREATE TABLE event_backward_extremities (
302
+ event_id text NOT NULL,
303
+ room_id text NOT NULL
304
+ );
305
+ CREATE TABLE event_edges (
306
+ event_id text NOT NULL,
307
+ prev_event_id text NOT NULL,
308
+ room_id text,
309
+ is_state boolean DEFAULT false NOT NULL
310
+ );
311
+ CREATE TABLE event_expiry (
312
+ event_id text NOT NULL,
313
+ expiry_ts bigint NOT NULL
314
+ );
315
+ CREATE TABLE event_forward_extremities (
316
+ event_id text NOT NULL,
317
+ room_id text NOT NULL
318
+ );
319
+ CREATE TABLE event_json (
320
+ event_id text NOT NULL,
321
+ room_id text NOT NULL,
322
+ internal_metadata text NOT NULL,
323
+ json text NOT NULL,
324
+ format_version integer
325
+ );
326
+ CREATE TABLE event_labels (
327
+ event_id text NOT NULL,
328
+ label text NOT NULL,
329
+ room_id text NOT NULL,
330
+ topological_ordering bigint NOT NULL
331
+ );
332
+ CREATE TABLE event_push_actions (
333
+ room_id text NOT NULL,
334
+ event_id text NOT NULL,
335
+ user_id text NOT NULL,
336
+ profile_tag character varying(32),
337
+ actions text NOT NULL,
338
+ topological_ordering bigint,
339
+ stream_ordering bigint,
340
+ notif smallint,
341
+ highlight smallint,
342
+ unread smallint,
343
+ thread_id text
344
+ );
345
+ CREATE TABLE event_push_actions_staging (
346
+ event_id text NOT NULL,
347
+ user_id text NOT NULL,
348
+ actions text NOT NULL,
349
+ notif smallint NOT NULL,
350
+ highlight smallint NOT NULL,
351
+ unread smallint,
352
+ thread_id text
353
+ );
354
+ CREATE TABLE event_push_summary (
355
+ user_id text NOT NULL,
356
+ room_id text NOT NULL,
357
+ notif_count bigint NOT NULL,
358
+ stream_ordering bigint NOT NULL,
359
+ unread_count bigint,
360
+ last_receipt_stream_ordering bigint,
361
+ thread_id text
362
+ );
363
+ CREATE TABLE event_push_summary_last_receipt_stream_id (
364
+ lock character(1) DEFAULT 'X'::bpchar NOT NULL,
365
+ stream_id bigint NOT NULL,
366
+ CONSTRAINT event_push_summary_last_receipt_stream_id_lock_check CHECK ((lock = 'X'::bpchar))
367
+ );
368
+ CREATE TABLE event_push_summary_stream_ordering (
369
+ lock character(1) DEFAULT 'X'::bpchar NOT NULL,
370
+ stream_ordering bigint NOT NULL,
371
+ CONSTRAINT event_push_summary_stream_ordering_lock_check CHECK ((lock = 'X'::bpchar))
372
+ );
373
+ CREATE TABLE event_relations (
374
+ event_id text NOT NULL,
375
+ relates_to_id text NOT NULL,
376
+ relation_type text NOT NULL,
377
+ aggregation_key text
378
+ );
379
+ CREATE TABLE event_reports (
380
+ id bigint NOT NULL,
381
+ received_ts bigint NOT NULL,
382
+ room_id text NOT NULL,
383
+ event_id text NOT NULL,
384
+ user_id text NOT NULL,
385
+ reason text,
386
+ content text
387
+ );
388
+ CREATE TABLE event_search (
389
+ event_id text,
390
+ room_id text,
391
+ sender text,
392
+ key text,
393
+ vector tsvector,
394
+ origin_server_ts bigint,
395
+ stream_ordering bigint
396
+ );
397
+ CREATE TABLE event_to_state_groups (
398
+ event_id text NOT NULL,
399
+ state_group bigint NOT NULL
400
+ );
401
+ CREATE TABLE event_txn_id (
402
+ event_id text NOT NULL,
403
+ room_id text NOT NULL,
404
+ user_id text NOT NULL,
405
+ token_id bigint NOT NULL,
406
+ txn_id text NOT NULL,
407
+ inserted_ts bigint NOT NULL
408
+ );
409
+ CREATE TABLE events (
410
+ topological_ordering bigint NOT NULL,
411
+ event_id text NOT NULL,
412
+ type text NOT NULL,
413
+ room_id text NOT NULL,
414
+ content text,
415
+ unrecognized_keys text,
416
+ processed boolean NOT NULL,
417
+ outlier boolean NOT NULL,
418
+ depth bigint DEFAULT 0 NOT NULL,
419
+ origin_server_ts bigint,
420
+ received_ts bigint,
421
+ sender text,
422
+ contains_url boolean,
423
+ instance_name text,
424
+ stream_ordering bigint,
425
+ state_key text,
426
+ rejection_reason text
427
+ );
428
+ CREATE SEQUENCE events_backfill_stream_seq
429
+ START WITH 1
430
+ INCREMENT BY 1
431
+ NO MINVALUE
432
+ NO MAXVALUE
433
+ CACHE 1;
434
+ CREATE SEQUENCE events_stream_seq
435
+ START WITH 1
436
+ INCREMENT BY 1
437
+ NO MINVALUE
438
+ NO MAXVALUE
439
+ CACHE 1;
440
+ CREATE TABLE ex_outlier_stream (
441
+ event_stream_ordering bigint NOT NULL,
442
+ event_id text NOT NULL,
443
+ state_group bigint NOT NULL,
444
+ instance_name text
445
+ );
446
+ CREATE TABLE federation_inbound_events_staging (
447
+ origin text NOT NULL,
448
+ room_id text NOT NULL,
449
+ event_id text NOT NULL,
450
+ received_ts bigint NOT NULL,
451
+ event_json text NOT NULL,
452
+ internal_metadata text NOT NULL
453
+ );
454
+ CREATE TABLE federation_stream_position (
455
+ type text NOT NULL,
456
+ stream_id bigint NOT NULL,
457
+ instance_name text DEFAULT 'master'::text NOT NULL
458
+ );
459
+ CREATE TABLE ignored_users (
460
+ ignorer_user_id text NOT NULL,
461
+ ignored_user_id text NOT NULL
462
+ );
463
+ CREATE TABLE insertion_event_edges (
464
+ event_id text NOT NULL,
465
+ room_id text NOT NULL,
466
+ insertion_prev_event_id text NOT NULL
467
+ );
468
+ CREATE TABLE insertion_event_extremities (
469
+ event_id text NOT NULL,
470
+ room_id text NOT NULL
471
+ );
472
+ CREATE TABLE insertion_events (
473
+ event_id text NOT NULL,
474
+ room_id text NOT NULL,
475
+ next_batch_id text NOT NULL
476
+ );
477
+ CREATE TABLE instance_map (
478
+ instance_id integer NOT NULL,
479
+ instance_name text NOT NULL
480
+ );
481
+ CREATE SEQUENCE instance_map_instance_id_seq
482
+ AS integer
483
+ START WITH 1
484
+ INCREMENT BY 1
485
+ NO MINVALUE
486
+ NO MAXVALUE
487
+ CACHE 1;
488
+ ALTER SEQUENCE instance_map_instance_id_seq OWNED BY instance_map.instance_id;
489
+ CREATE TABLE local_current_membership (
490
+ room_id text NOT NULL,
491
+ user_id text NOT NULL,
492
+ event_id text NOT NULL,
493
+ membership text NOT NULL
494
+ );
495
+ CREATE TABLE local_media_repository (
496
+ media_id text,
497
+ media_type text,
498
+ media_length integer,
499
+ created_ts bigint,
500
+ upload_name text,
501
+ user_id text,
502
+ quarantined_by text,
503
+ url_cache text,
504
+ last_access_ts bigint,
505
+ safe_from_quarantine boolean DEFAULT false NOT NULL
506
+ );
507
+ CREATE TABLE local_media_repository_thumbnails (
508
+ media_id text,
509
+ thumbnail_width integer,
510
+ thumbnail_height integer,
511
+ thumbnail_type text,
512
+ thumbnail_method text,
513
+ thumbnail_length integer
514
+ );
515
+ CREATE TABLE local_media_repository_url_cache (
516
+ url text,
517
+ response_code integer,
518
+ etag text,
519
+ expires_ts bigint,
520
+ og text,
521
+ media_id text,
522
+ download_ts bigint
523
+ );
524
+ CREATE TABLE monthly_active_users (
525
+ user_id text NOT NULL,
526
+ "timestamp" bigint NOT NULL
527
+ );
528
+ CREATE TABLE open_id_tokens (
529
+ token text NOT NULL,
530
+ ts_valid_until_ms bigint NOT NULL,
531
+ user_id text NOT NULL
532
+ );
533
+ CREATE TABLE partial_state_events (
534
+ room_id text NOT NULL,
535
+ event_id text NOT NULL
536
+ );
537
+ CREATE TABLE partial_state_rooms (
538
+ room_id text NOT NULL
539
+ );
540
+ CREATE TABLE partial_state_rooms_servers (
541
+ room_id text NOT NULL,
542
+ server_name text NOT NULL
543
+ );
544
+ CREATE TABLE presence (
545
+ user_id text NOT NULL,
546
+ state character varying(20),
547
+ status_msg text,
548
+ mtime bigint
549
+ );
550
+ CREATE TABLE presence_stream (
551
+ stream_id bigint,
552
+ user_id text,
553
+ state text,
554
+ last_active_ts bigint,
555
+ last_federation_update_ts bigint,
556
+ last_user_sync_ts bigint,
557
+ status_msg text,
558
+ currently_active boolean,
559
+ instance_name text
560
+ );
561
+ CREATE SEQUENCE presence_stream_sequence
562
+ START WITH 1
563
+ INCREMENT BY 1
564
+ NO MINVALUE
565
+ NO MAXVALUE
566
+ CACHE 1;
567
+ CREATE TABLE profiles (
568
+ user_id text NOT NULL,
569
+ displayname text,
570
+ avatar_url text
571
+ );
572
+ CREATE TABLE push_rules (
573
+ id bigint NOT NULL,
574
+ user_name text NOT NULL,
575
+ rule_id text NOT NULL,
576
+ priority_class smallint NOT NULL,
577
+ priority integer DEFAULT 0 NOT NULL,
578
+ conditions text NOT NULL,
579
+ actions text NOT NULL
580
+ );
581
+ CREATE TABLE push_rules_enable (
582
+ id bigint NOT NULL,
583
+ user_name text NOT NULL,
584
+ rule_id text NOT NULL,
585
+ enabled smallint
586
+ );
587
+ CREATE TABLE push_rules_stream (
588
+ stream_id bigint NOT NULL,
589
+ event_stream_ordering bigint NOT NULL,
590
+ user_id text NOT NULL,
591
+ rule_id text NOT NULL,
592
+ op text NOT NULL,
593
+ priority_class smallint,
594
+ priority integer,
595
+ conditions text,
596
+ actions text
597
+ );
598
+ CREATE TABLE pusher_throttle (
599
+ pusher bigint NOT NULL,
600
+ room_id text NOT NULL,
601
+ last_sent_ts bigint,
602
+ throttle_ms bigint
603
+ );
604
+ CREATE TABLE pushers (
605
+ id bigint NOT NULL,
606
+ user_name text NOT NULL,
607
+ access_token bigint,
608
+ profile_tag text NOT NULL,
609
+ kind text NOT NULL,
610
+ app_id text NOT NULL,
611
+ app_display_name text NOT NULL,
612
+ device_display_name text NOT NULL,
613
+ pushkey text NOT NULL,
614
+ ts bigint NOT NULL,
615
+ lang text,
616
+ data text,
617
+ last_stream_ordering bigint,
618
+ last_success bigint,
619
+ failing_since bigint
620
+ );
621
+ CREATE TABLE ratelimit_override (
622
+ user_id text NOT NULL,
623
+ messages_per_second bigint,
624
+ burst_count bigint
625
+ );
626
+ CREATE TABLE receipts_graph (
627
+ room_id text NOT NULL,
628
+ receipt_type text NOT NULL,
629
+ user_id text NOT NULL,
630
+ event_ids text NOT NULL,
631
+ data text NOT NULL,
632
+ thread_id text
633
+ );
634
+ CREATE TABLE receipts_linearized (
635
+ stream_id bigint NOT NULL,
636
+ room_id text NOT NULL,
637
+ receipt_type text NOT NULL,
638
+ user_id text NOT NULL,
639
+ event_id text NOT NULL,
640
+ data text NOT NULL,
641
+ instance_name text,
642
+ event_stream_ordering bigint,
643
+ thread_id text
644
+ );
645
+ CREATE SEQUENCE receipts_sequence
646
+ START WITH 1
647
+ INCREMENT BY 1
648
+ NO MINVALUE
649
+ NO MAXVALUE
650
+ CACHE 1;
651
+ CREATE TABLE received_transactions (
652
+ transaction_id text,
653
+ origin text,
654
+ ts bigint,
655
+ response_code integer,
656
+ response_json bytea,
657
+ has_been_referenced smallint DEFAULT 0
658
+ );
659
+ CREATE TABLE redactions (
660
+ event_id text NOT NULL,
661
+ redacts text NOT NULL,
662
+ have_censored boolean DEFAULT false NOT NULL,
663
+ received_ts bigint
664
+ );
665
+ CREATE TABLE refresh_tokens (
666
+ id bigint NOT NULL,
667
+ user_id text NOT NULL,
668
+ device_id text NOT NULL,
669
+ token text NOT NULL,
670
+ next_token_id bigint,
671
+ expiry_ts bigint,
672
+ ultimate_session_expiry_ts bigint
673
+ );
674
+ CREATE TABLE registration_tokens (
675
+ token text NOT NULL,
676
+ uses_allowed integer,
677
+ pending integer NOT NULL,
678
+ completed integer NOT NULL,
679
+ expiry_time bigint
680
+ );
681
+ CREATE TABLE rejections (
682
+ event_id text NOT NULL,
683
+ reason text NOT NULL,
684
+ last_check text NOT NULL
685
+ );
686
+ CREATE TABLE remote_media_cache (
687
+ media_origin text,
688
+ media_id text,
689
+ media_type text,
690
+ created_ts bigint,
691
+ upload_name text,
692
+ media_length integer,
693
+ filesystem_id text,
694
+ last_access_ts bigint,
695
+ quarantined_by text
696
+ );
697
+ CREATE TABLE remote_media_cache_thumbnails (
698
+ media_origin text,
699
+ media_id text,
700
+ thumbnail_width integer,
701
+ thumbnail_height integer,
702
+ thumbnail_method text,
703
+ thumbnail_type text,
704
+ thumbnail_length integer,
705
+ filesystem_id text
706
+ );
707
+ CREATE TABLE room_account_data (
708
+ user_id text NOT NULL,
709
+ room_id text NOT NULL,
710
+ account_data_type text NOT NULL,
711
+ stream_id bigint NOT NULL,
712
+ content text NOT NULL,
713
+ instance_name text
714
+ );
715
+ CREATE TABLE room_alias_servers (
716
+ room_alias text NOT NULL,
717
+ server text NOT NULL
718
+ );
719
+ CREATE TABLE room_aliases (
720
+ room_alias text NOT NULL,
721
+ room_id text NOT NULL,
722
+ creator text
723
+ );
724
+ CREATE TABLE room_depth (
725
+ room_id text NOT NULL,
726
+ min_depth bigint
727
+ );
728
+ CREATE TABLE room_memberships (
729
+ event_id text NOT NULL,
730
+ user_id text NOT NULL,
731
+ sender text NOT NULL,
732
+ room_id text NOT NULL,
733
+ membership text NOT NULL,
734
+ forgotten integer DEFAULT 0,
735
+ display_name text,
736
+ avatar_url text
737
+ );
738
+ CREATE TABLE room_retention (
739
+ room_id text NOT NULL,
740
+ event_id text NOT NULL,
741
+ min_lifetime bigint,
742
+ max_lifetime bigint
743
+ );
744
+ CREATE TABLE room_stats_current (
745
+ room_id text NOT NULL,
746
+ current_state_events integer NOT NULL,
747
+ joined_members integer NOT NULL,
748
+ invited_members integer NOT NULL,
749
+ left_members integer NOT NULL,
750
+ banned_members integer NOT NULL,
751
+ local_users_in_room integer NOT NULL,
752
+ completed_delta_stream_id bigint NOT NULL,
753
+ knocked_members integer
754
+ );
755
+ CREATE TABLE room_stats_earliest_token (
756
+ room_id text NOT NULL,
757
+ token bigint NOT NULL
758
+ );
759
+ CREATE TABLE room_stats_state (
760
+ room_id text NOT NULL,
761
+ name text,
762
+ canonical_alias text,
763
+ join_rules text,
764
+ history_visibility text,
765
+ encryption text,
766
+ avatar text,
767
+ guest_access text,
768
+ is_federatable boolean,
769
+ topic text,
770
+ room_type text
771
+ );
772
+ CREATE TABLE room_tags (
773
+ user_id text NOT NULL,
774
+ room_id text NOT NULL,
775
+ tag text NOT NULL,
776
+ content text NOT NULL
777
+ );
778
+ CREATE TABLE room_tags_revisions (
779
+ user_id text NOT NULL,
780
+ room_id text NOT NULL,
781
+ stream_id bigint NOT NULL,
782
+ instance_name text
783
+ );
784
+ CREATE TABLE rooms (
785
+ room_id text NOT NULL,
786
+ is_public boolean,
787
+ creator text,
788
+ room_version text,
789
+ has_auth_chain_index boolean
790
+ );
791
+ CREATE TABLE server_keys_json (
792
+ server_name text NOT NULL,
793
+ key_id text NOT NULL,
794
+ from_server text NOT NULL,
795
+ ts_added_ms bigint NOT NULL,
796
+ ts_valid_until_ms bigint NOT NULL,
797
+ key_json bytea NOT NULL
798
+ );
799
+ CREATE TABLE server_signature_keys (
800
+ server_name text,
801
+ key_id text,
802
+ from_server text,
803
+ ts_added_ms bigint,
804
+ verify_key bytea,
805
+ ts_valid_until_ms bigint
806
+ );
807
+ CREATE TABLE sessions (
808
+ session_type text NOT NULL,
809
+ session_id text NOT NULL,
810
+ value text NOT NULL,
811
+ expiry_time_ms bigint NOT NULL
812
+ );
813
+ CREATE TABLE state_events (
814
+ event_id text NOT NULL,
815
+ room_id text NOT NULL,
816
+ type text NOT NULL,
817
+ state_key text NOT NULL,
818
+ prev_state text
819
+ );
820
+ CREATE TABLE stats_incremental_position (
821
+ lock character(1) DEFAULT 'X'::bpchar NOT NULL,
822
+ stream_id bigint NOT NULL,
823
+ CONSTRAINT stats_incremental_position_lock_check CHECK ((lock = 'X'::bpchar))
824
+ );
825
+ CREATE TABLE stream_ordering_to_exterm (
826
+ stream_ordering bigint NOT NULL,
827
+ room_id text NOT NULL,
828
+ event_id text NOT NULL
829
+ );
830
+ CREATE TABLE stream_positions (
831
+ stream_name text NOT NULL,
832
+ instance_name text NOT NULL,
833
+ stream_id bigint NOT NULL
834
+ );
835
+ CREATE TABLE threepid_guest_access_tokens (
836
+ medium text,
837
+ address text,
838
+ guest_access_token text,
839
+ first_inviter text
840
+ );
841
+ CREATE TABLE threepid_validation_session (
842
+ session_id text NOT NULL,
843
+ medium text NOT NULL,
844
+ address text NOT NULL,
845
+ client_secret text NOT NULL,
846
+ last_send_attempt bigint NOT NULL,
847
+ validated_at bigint
848
+ );
849
+ CREATE TABLE threepid_validation_token (
850
+ token text NOT NULL,
851
+ session_id text NOT NULL,
852
+ next_link text,
853
+ expires bigint NOT NULL
854
+ );
855
+ CREATE TABLE ui_auth_sessions (
856
+ session_id text NOT NULL,
857
+ creation_time bigint NOT NULL,
858
+ serverdict text NOT NULL,
859
+ clientdict text NOT NULL,
860
+ uri text NOT NULL,
861
+ method text NOT NULL,
862
+ description text NOT NULL
863
+ );
864
+ CREATE TABLE ui_auth_sessions_credentials (
865
+ session_id text NOT NULL,
866
+ stage_type text NOT NULL,
867
+ result text NOT NULL
868
+ );
869
+ CREATE TABLE ui_auth_sessions_ips (
870
+ session_id text NOT NULL,
871
+ ip text NOT NULL,
872
+ user_agent text NOT NULL
873
+ );
874
+ CREATE TABLE user_daily_visits (
875
+ user_id text NOT NULL,
876
+ device_id text,
877
+ "timestamp" bigint NOT NULL,
878
+ user_agent text
879
+ );
880
+ CREATE TABLE user_directory (
881
+ user_id text NOT NULL,
882
+ room_id text,
883
+ display_name text,
884
+ avatar_url text
885
+ );
886
+ CREATE TABLE user_directory_search (
887
+ user_id text NOT NULL,
888
+ vector tsvector
889
+ );
890
+ CREATE TABLE user_directory_stream_pos (
891
+ lock character(1) DEFAULT 'X'::bpchar NOT NULL,
892
+ stream_id bigint,
893
+ CONSTRAINT user_directory_stream_pos_lock_check CHECK ((lock = 'X'::bpchar))
894
+ );
895
+ CREATE TABLE user_external_ids (
896
+ auth_provider text NOT NULL,
897
+ external_id text NOT NULL,
898
+ user_id text NOT NULL
899
+ );
900
+ CREATE TABLE user_filters (
901
+ user_id text NOT NULL,
902
+ filter_id bigint NOT NULL,
903
+ filter_json bytea NOT NULL
904
+ );
905
+ CREATE SEQUENCE user_id_seq
906
+ START WITH 1
907
+ INCREMENT BY 1
908
+ NO MINVALUE
909
+ NO MAXVALUE
910
+ CACHE 1;
911
+ CREATE TABLE user_ips (
912
+ user_id text NOT NULL,
913
+ access_token text NOT NULL,
914
+ device_id text,
915
+ ip text NOT NULL,
916
+ user_agent text NOT NULL,
917
+ last_seen bigint NOT NULL
918
+ );
919
+ CREATE TABLE user_signature_stream (
920
+ stream_id bigint NOT NULL,
921
+ from_user_id text NOT NULL,
922
+ user_ids text NOT NULL
923
+ );
924
+ CREATE TABLE user_stats_current (
925
+ user_id text NOT NULL,
926
+ joined_rooms bigint NOT NULL,
927
+ completed_delta_stream_id bigint NOT NULL
928
+ );
929
+ CREATE TABLE user_threepid_id_server (
930
+ user_id text NOT NULL,
931
+ medium text NOT NULL,
932
+ address text NOT NULL,
933
+ id_server text NOT NULL
934
+ );
935
+ CREATE TABLE user_threepids (
936
+ user_id text NOT NULL,
937
+ medium text NOT NULL,
938
+ address text NOT NULL,
939
+ validated_at bigint NOT NULL,
940
+ added_at bigint NOT NULL
941
+ );
942
+ CREATE TABLE users (
943
+ name text,
944
+ password_hash text,
945
+ creation_ts bigint,
946
+ admin smallint DEFAULT 0 NOT NULL,
947
+ upgrade_ts bigint,
948
+ is_guest smallint DEFAULT 0 NOT NULL,
949
+ appservice_id text,
950
+ consent_version text,
951
+ consent_server_notice_sent text,
952
+ user_type text,
953
+ deactivated smallint DEFAULT 0 NOT NULL,
954
+ shadow_banned boolean,
955
+ consent_ts bigint
956
+ );
957
+ CREATE TABLE users_in_public_rooms (
958
+ user_id text NOT NULL,
959
+ room_id text NOT NULL
960
+ );
961
+ CREATE TABLE users_pending_deactivation (
962
+ user_id text NOT NULL
963
+ );
964
+ CREATE TABLE users_to_send_full_presence_to (
965
+ user_id text NOT NULL,
966
+ presence_stream_id bigint
967
+ );
968
+ CREATE TABLE users_who_share_private_rooms (
969
+ user_id text NOT NULL,
970
+ other_user_id text NOT NULL,
971
+ room_id text NOT NULL
972
+ );
973
+ CREATE TABLE worker_locks (
974
+ lock_name text NOT NULL,
975
+ lock_key text NOT NULL,
976
+ instance_name text NOT NULL,
977
+ token text NOT NULL,
978
+ last_renewed_ts bigint NOT NULL
979
+ );
980
+ ALTER TABLE ONLY instance_map ALTER COLUMN instance_id SET DEFAULT nextval('instance_map_instance_id_seq'::regclass);
981
+ ALTER TABLE ONLY access_tokens
982
+ ADD CONSTRAINT access_tokens_pkey PRIMARY KEY (id);
983
+ ALTER TABLE ONLY access_tokens
984
+ ADD CONSTRAINT access_tokens_token_key UNIQUE (token);
985
+ ALTER TABLE ONLY account_data
986
+ ADD CONSTRAINT account_data_uniqueness UNIQUE (user_id, account_data_type);
987
+ ALTER TABLE ONLY account_validity
988
+ ADD CONSTRAINT account_validity_pkey PRIMARY KEY (user_id);
989
+ ALTER TABLE ONLY application_services_state
990
+ ADD CONSTRAINT application_services_state_pkey PRIMARY KEY (as_id);
991
+ ALTER TABLE ONLY application_services_txns
992
+ ADD CONSTRAINT application_services_txns_as_id_txn_id_key UNIQUE (as_id, txn_id);
993
+ ALTER TABLE ONLY appservice_stream_position
994
+ ADD CONSTRAINT appservice_stream_position_lock_key UNIQUE (lock);
995
+ ALTER TABLE ONLY current_state_events
996
+ ADD CONSTRAINT current_state_events_event_id_key UNIQUE (event_id);
997
+ ALTER TABLE ONLY current_state_events
998
+ ADD CONSTRAINT current_state_events_room_id_type_state_key_key UNIQUE (room_id, type, state_key);
999
+ ALTER TABLE ONLY dehydrated_devices
1000
+ ADD CONSTRAINT dehydrated_devices_pkey PRIMARY KEY (user_id);
1001
+ ALTER TABLE ONLY destination_rooms
1002
+ ADD CONSTRAINT destination_rooms_pkey PRIMARY KEY (destination, room_id);
1003
+ ALTER TABLE ONLY destinations
1004
+ ADD CONSTRAINT destinations_pkey PRIMARY KEY (destination);
1005
+ ALTER TABLE ONLY devices
1006
+ ADD CONSTRAINT device_uniqueness UNIQUE (user_id, device_id);
1007
+ ALTER TABLE ONLY e2e_device_keys_json
1008
+ ADD CONSTRAINT e2e_device_keys_json_uniqueness UNIQUE (user_id, device_id);
1009
+ ALTER TABLE ONLY e2e_fallback_keys_json
1010
+ ADD CONSTRAINT e2e_fallback_keys_json_uniqueness UNIQUE (user_id, device_id, algorithm);
1011
+ ALTER TABLE ONLY e2e_one_time_keys_json
1012
+ ADD CONSTRAINT e2e_one_time_keys_json_uniqueness UNIQUE (user_id, device_id, algorithm, key_id);
1013
+ ALTER TABLE ONLY event_auth_chain_to_calculate
1014
+ ADD CONSTRAINT event_auth_chain_to_calculate_pkey PRIMARY KEY (event_id);
1015
+ ALTER TABLE ONLY event_auth_chains
1016
+ ADD CONSTRAINT event_auth_chains_pkey PRIMARY KEY (event_id);
1017
+ ALTER TABLE ONLY event_backward_extremities
1018
+ ADD CONSTRAINT event_backward_extremities_event_id_room_id_key UNIQUE (event_id, room_id);
1019
+ ALTER TABLE ONLY event_expiry
1020
+ ADD CONSTRAINT event_expiry_pkey PRIMARY KEY (event_id);
1021
+ ALTER TABLE ONLY event_forward_extremities
1022
+ ADD CONSTRAINT event_forward_extremities_event_id_room_id_key UNIQUE (event_id, room_id);
1023
+ ALTER TABLE ONLY event_push_actions
1024
+ ADD CONSTRAINT event_id_user_id_profile_tag_uniqueness UNIQUE (room_id, event_id, user_id, profile_tag);
1025
+ ALTER TABLE ONLY event_json
1026
+ ADD CONSTRAINT event_json_event_id_key UNIQUE (event_id);
1027
+ ALTER TABLE ONLY event_labels
1028
+ ADD CONSTRAINT event_labels_pkey PRIMARY KEY (event_id, label);
1029
+ ALTER TABLE ONLY event_push_summary_last_receipt_stream_id
1030
+ ADD CONSTRAINT event_push_summary_last_receipt_stream_id_lock_key UNIQUE (lock);
1031
+ ALTER TABLE ONLY event_push_summary_stream_ordering
1032
+ ADD CONSTRAINT event_push_summary_stream_ordering_lock_key UNIQUE (lock);
1033
+ ALTER TABLE ONLY event_reports
1034
+ ADD CONSTRAINT event_reports_pkey PRIMARY KEY (id);
1035
+ ALTER TABLE ONLY event_to_state_groups
1036
+ ADD CONSTRAINT event_to_state_groups_event_id_key UNIQUE (event_id);
1037
+ ALTER TABLE ONLY events
1038
+ ADD CONSTRAINT events_event_id_key UNIQUE (event_id);
1039
+ ALTER TABLE ONLY ex_outlier_stream
1040
+ ADD CONSTRAINT ex_outlier_stream_pkey PRIMARY KEY (event_stream_ordering);
1041
+ ALTER TABLE ONLY instance_map
1042
+ ADD CONSTRAINT instance_map_pkey PRIMARY KEY (instance_id);
1043
+ ALTER TABLE ONLY local_media_repository
1044
+ ADD CONSTRAINT local_media_repository_media_id_key UNIQUE (media_id);
1045
+ ALTER TABLE ONLY user_threepids
1046
+ ADD CONSTRAINT medium_address UNIQUE (medium, address);
1047
+ ALTER TABLE ONLY open_id_tokens
1048
+ ADD CONSTRAINT open_id_tokens_pkey PRIMARY KEY (token);
1049
+ ALTER TABLE ONLY partial_state_events
1050
+ ADD CONSTRAINT partial_state_events_event_id_key UNIQUE (event_id);
1051
+ ALTER TABLE ONLY partial_state_rooms
1052
+ ADD CONSTRAINT partial_state_rooms_pkey PRIMARY KEY (room_id);
1053
+ ALTER TABLE ONLY partial_state_rooms_servers
1054
+ ADD CONSTRAINT partial_state_rooms_servers_room_id_server_name_key UNIQUE (room_id, server_name);
1055
+ ALTER TABLE ONLY presence
1056
+ ADD CONSTRAINT presence_user_id_key UNIQUE (user_id);
1057
+ ALTER TABLE ONLY profiles
1058
+ ADD CONSTRAINT profiles_user_id_key UNIQUE (user_id);
1059
+ ALTER TABLE ONLY push_rules_enable
1060
+ ADD CONSTRAINT push_rules_enable_pkey PRIMARY KEY (id);
1061
+ ALTER TABLE ONLY push_rules_enable
1062
+ ADD CONSTRAINT push_rules_enable_user_name_rule_id_key UNIQUE (user_name, rule_id);
1063
+ ALTER TABLE ONLY push_rules
1064
+ ADD CONSTRAINT push_rules_pkey PRIMARY KEY (id);
1065
+ ALTER TABLE ONLY push_rules
1066
+ ADD CONSTRAINT push_rules_user_name_rule_id_key UNIQUE (user_name, rule_id);
1067
+ ALTER TABLE ONLY pusher_throttle
1068
+ ADD CONSTRAINT pusher_throttle_pkey PRIMARY KEY (pusher, room_id);
1069
+ ALTER TABLE ONLY pushers
1070
+ ADD CONSTRAINT pushers2_app_id_pushkey_user_name_key UNIQUE (app_id, pushkey, user_name);
1071
+ ALTER TABLE ONLY pushers
1072
+ ADD CONSTRAINT pushers2_pkey PRIMARY KEY (id);
1073
+ ALTER TABLE ONLY receipts_graph
1074
+ ADD CONSTRAINT receipts_graph_uniqueness UNIQUE (room_id, receipt_type, user_id);
1075
+ ALTER TABLE ONLY receipts_graph
1076
+ ADD CONSTRAINT receipts_graph_uniqueness_thread UNIQUE (room_id, receipt_type, user_id, thread_id);
1077
+ ALTER TABLE ONLY receipts_linearized
1078
+ ADD CONSTRAINT receipts_linearized_uniqueness UNIQUE (room_id, receipt_type, user_id);
1079
+ ALTER TABLE ONLY receipts_linearized
1080
+ ADD CONSTRAINT receipts_linearized_uniqueness_thread UNIQUE (room_id, receipt_type, user_id, thread_id);
1081
+ ALTER TABLE ONLY received_transactions
1082
+ ADD CONSTRAINT received_transactions_transaction_id_origin_key UNIQUE (transaction_id, origin);
1083
+ ALTER TABLE ONLY redactions
1084
+ ADD CONSTRAINT redactions_event_id_key UNIQUE (event_id);
1085
+ ALTER TABLE ONLY refresh_tokens
1086
+ ADD CONSTRAINT refresh_tokens_pkey PRIMARY KEY (id);
1087
+ ALTER TABLE ONLY refresh_tokens
1088
+ ADD CONSTRAINT refresh_tokens_token_key UNIQUE (token);
1089
+ ALTER TABLE ONLY registration_tokens
1090
+ ADD CONSTRAINT registration_tokens_token_key UNIQUE (token);
1091
+ ALTER TABLE ONLY rejections
1092
+ ADD CONSTRAINT rejections_event_id_key UNIQUE (event_id);
1093
+ ALTER TABLE ONLY remote_media_cache
1094
+ ADD CONSTRAINT remote_media_cache_media_origin_media_id_key UNIQUE (media_origin, media_id);
1095
+ ALTER TABLE ONLY room_account_data
1096
+ ADD CONSTRAINT room_account_data_uniqueness UNIQUE (user_id, room_id, account_data_type);
1097
+ ALTER TABLE ONLY room_aliases
1098
+ ADD CONSTRAINT room_aliases_room_alias_key UNIQUE (room_alias);
1099
+ ALTER TABLE ONLY room_depth
1100
+ ADD CONSTRAINT room_depth_room_id_key UNIQUE (room_id);
1101
+ ALTER TABLE ONLY room_memberships
1102
+ ADD CONSTRAINT room_memberships_event_id_key UNIQUE (event_id);
1103
+ ALTER TABLE ONLY room_retention
1104
+ ADD CONSTRAINT room_retention_pkey PRIMARY KEY (room_id, event_id);
1105
+ ALTER TABLE ONLY room_stats_current
1106
+ ADD CONSTRAINT room_stats_current_pkey PRIMARY KEY (room_id);
1107
+ ALTER TABLE ONLY room_tags_revisions
1108
+ ADD CONSTRAINT room_tag_revisions_uniqueness UNIQUE (user_id, room_id);
1109
+ ALTER TABLE ONLY room_tags
1110
+ ADD CONSTRAINT room_tag_uniqueness UNIQUE (user_id, room_id, tag);
1111
+ ALTER TABLE ONLY rooms
1112
+ ADD CONSTRAINT rooms_pkey PRIMARY KEY (room_id);
1113
+ ALTER TABLE ONLY server_keys_json
1114
+ ADD CONSTRAINT server_keys_json_uniqueness UNIQUE (server_name, key_id, from_server);
1115
+ ALTER TABLE ONLY server_signature_keys
1116
+ ADD CONSTRAINT server_signature_keys_server_name_key_id_key UNIQUE (server_name, key_id);
1117
+ ALTER TABLE ONLY sessions
1118
+ ADD CONSTRAINT sessions_session_type_session_id_key UNIQUE (session_type, session_id);
1119
+ ALTER TABLE ONLY state_events
1120
+ ADD CONSTRAINT state_events_event_id_key UNIQUE (event_id);
1121
+ ALTER TABLE ONLY stats_incremental_position
1122
+ ADD CONSTRAINT stats_incremental_position_lock_key UNIQUE (lock);
1123
+ ALTER TABLE ONLY threepid_validation_session
1124
+ ADD CONSTRAINT threepid_validation_session_pkey PRIMARY KEY (session_id);
1125
+ ALTER TABLE ONLY threepid_validation_token
1126
+ ADD CONSTRAINT threepid_validation_token_pkey PRIMARY KEY (token);
1127
+ ALTER TABLE ONLY ui_auth_sessions_credentials
1128
+ ADD CONSTRAINT ui_auth_sessions_credentials_session_id_stage_type_key UNIQUE (session_id, stage_type);
1129
+ ALTER TABLE ONLY ui_auth_sessions_ips
1130
+ ADD CONSTRAINT ui_auth_sessions_ips_session_id_ip_user_agent_key UNIQUE (session_id, ip, user_agent);
1131
+ ALTER TABLE ONLY ui_auth_sessions
1132
+ ADD CONSTRAINT ui_auth_sessions_session_id_key UNIQUE (session_id);
1133
+ ALTER TABLE ONLY user_directory_stream_pos
1134
+ ADD CONSTRAINT user_directory_stream_pos_lock_key UNIQUE (lock);
1135
+ ALTER TABLE ONLY user_external_ids
1136
+ ADD CONSTRAINT user_external_ids_auth_provider_external_id_key UNIQUE (auth_provider, external_id);
1137
+ ALTER TABLE ONLY user_stats_current
1138
+ ADD CONSTRAINT user_stats_current_pkey PRIMARY KEY (user_id);
1139
+ ALTER TABLE ONLY users
1140
+ ADD CONSTRAINT users_name_key UNIQUE (name);
1141
+ ALTER TABLE ONLY users_to_send_full_presence_to
1142
+ ADD CONSTRAINT users_to_send_full_presence_to_pkey PRIMARY KEY (user_id);
1143
+ CREATE INDEX access_tokens_device_id ON access_tokens USING btree (user_id, device_id);
1144
+ CREATE INDEX account_data_stream_id ON account_data USING btree (user_id, stream_id);
1145
+ CREATE INDEX application_services_txns_id ON application_services_txns USING btree (as_id);
1146
+ CREATE UNIQUE INDEX appservice_room_list_idx ON appservice_room_list USING btree (appservice_id, network_id, room_id);
1147
+ CREATE INDEX batch_events_batch_id ON batch_events USING btree (batch_id);
1148
+ CREATE UNIQUE INDEX blocked_rooms_idx ON blocked_rooms USING btree (room_id);
1149
+ CREATE UNIQUE INDEX cache_invalidation_stream_by_instance_id ON cache_invalidation_stream_by_instance USING btree (stream_id);
1150
+ CREATE INDEX cache_invalidation_stream_by_instance_instance_index ON cache_invalidation_stream_by_instance USING btree (instance_name, stream_id);
1151
+ CREATE UNIQUE INDEX chunk_events_event_id ON batch_events USING btree (event_id);
1152
+ CREATE INDEX current_state_delta_stream_idx ON current_state_delta_stream USING btree (stream_id);
1153
+ CREATE INDEX current_state_events_member_index ON current_state_events USING btree (state_key) WHERE (type = 'm.room.member'::text);
1154
+ CREATE INDEX deleted_pushers_stream_id ON deleted_pushers USING btree (stream_id);
1155
+ CREATE INDEX destination_rooms_room_id ON destination_rooms USING btree (room_id);
1156
+ CREATE INDEX device_auth_providers_devices ON device_auth_providers USING btree (user_id, device_id);
1157
+ CREATE INDEX device_auth_providers_sessions ON device_auth_providers USING btree (auth_provider_id, auth_provider_session_id);
1158
+ CREATE INDEX device_federation_inbox_sender_id ON device_federation_inbox USING btree (origin, message_id);
1159
+ CREATE INDEX device_federation_outbox_destination_id ON device_federation_outbox USING btree (destination, stream_id);
1160
+ CREATE INDEX device_federation_outbox_id ON device_federation_outbox USING btree (stream_id);
1161
+ CREATE INDEX device_inbox_stream_id_user_id ON device_inbox USING btree (stream_id, user_id);
1162
+ CREATE INDEX device_inbox_user_stream_id ON device_inbox USING btree (user_id, device_id, stream_id);
1163
+ CREATE UNIQUE INDEX device_lists_changes_in_stream_id ON device_lists_changes_in_room USING btree (stream_id, room_id);
1164
+ CREATE INDEX device_lists_changes_in_stream_id_unconverted ON device_lists_changes_in_room USING btree (stream_id) WHERE (NOT converted_to_destinations);
1165
+ CREATE UNIQUE INDEX device_lists_outbound_last_success_unique_idx ON device_lists_outbound_last_success USING btree (destination, user_id);
1166
+ CREATE INDEX device_lists_outbound_pokes_id ON device_lists_outbound_pokes USING btree (destination, stream_id);
1167
+ CREATE INDEX device_lists_outbound_pokes_stream ON device_lists_outbound_pokes USING btree (stream_id);
1168
+ CREATE INDEX device_lists_outbound_pokes_user ON device_lists_outbound_pokes USING btree (destination, user_id);
1169
+ CREATE UNIQUE INDEX device_lists_remote_cache_unique_id ON device_lists_remote_cache USING btree (user_id, device_id);
1170
+ CREATE UNIQUE INDEX device_lists_remote_extremeties_unique_idx ON device_lists_remote_extremeties USING btree (user_id);
1171
+ CREATE UNIQUE INDEX device_lists_remote_resync_idx ON device_lists_remote_resync USING btree (user_id);
1172
+ CREATE INDEX device_lists_remote_resync_ts_idx ON device_lists_remote_resync USING btree (added_ts);
1173
+ CREATE INDEX device_lists_stream_id ON device_lists_stream USING btree (stream_id, user_id);
1174
+ CREATE INDEX device_lists_stream_user_id ON device_lists_stream USING btree (user_id, device_id);
1175
+ CREATE UNIQUE INDEX e2e_cross_signing_keys_idx ON e2e_cross_signing_keys USING btree (user_id, keytype, stream_id);
1176
+ CREATE UNIQUE INDEX e2e_cross_signing_keys_stream_idx ON e2e_cross_signing_keys USING btree (stream_id);
1177
+ CREATE INDEX e2e_cross_signing_signatures2_idx ON e2e_cross_signing_signatures USING btree (user_id, target_user_id, target_device_id);
1178
+ CREATE UNIQUE INDEX e2e_room_keys_versions_idx ON e2e_room_keys_versions USING btree (user_id, version);
1179
+ CREATE UNIQUE INDEX e2e_room_keys_with_version_idx ON e2e_room_keys USING btree (user_id, version, room_id, session_id);
1180
+ CREATE UNIQUE INDEX erased_users_user ON erased_users USING btree (user_id);
1181
+ CREATE INDEX ev_b_extrem_id ON event_backward_extremities USING btree (event_id);
1182
+ CREATE INDEX ev_b_extrem_room ON event_backward_extremities USING btree (room_id);
1183
+ CREATE INDEX ev_edges_prev_id ON event_edges USING btree (prev_event_id);
1184
+ CREATE INDEX ev_extrem_id ON event_forward_extremities USING btree (event_id);
1185
+ CREATE INDEX ev_extrem_room ON event_forward_extremities USING btree (room_id);
1186
+ CREATE INDEX evauth_edges_id ON event_auth USING btree (event_id);
1187
+ CREATE INDEX event_auth_chain_links_idx ON event_auth_chain_links USING btree (origin_chain_id, target_chain_id);
1188
+ CREATE INDEX event_auth_chain_to_calculate_rm_id ON event_auth_chain_to_calculate USING btree (room_id);
1189
+ CREATE UNIQUE INDEX event_auth_chains_c_seq_index ON event_auth_chains USING btree (chain_id, sequence_number);
1190
+ CREATE INDEX event_contains_url_index ON events USING btree (room_id, topological_ordering, stream_ordering) WHERE ((contains_url = true) AND (outlier = false));
1191
+ CREATE UNIQUE INDEX event_edges_event_id_prev_event_id_idx ON event_edges USING btree (event_id, prev_event_id);
1192
+ CREATE INDEX event_expiry_expiry_ts_idx ON event_expiry USING btree (expiry_ts);
1193
+ CREATE INDEX event_labels_room_id_label_idx ON event_labels USING btree (room_id, label, topological_ordering);
1194
+ CREATE INDEX event_push_actions_highlights_index ON event_push_actions USING btree (user_id, room_id, topological_ordering, stream_ordering) WHERE (highlight = 1);
1195
+ CREATE INDEX event_push_actions_rm_tokens ON event_push_actions USING btree (user_id, room_id, topological_ordering, stream_ordering);
1196
+ CREATE INDEX event_push_actions_room_id_user_id ON event_push_actions USING btree (room_id, user_id);
1197
+ CREATE INDEX event_push_actions_staging_id ON event_push_actions_staging USING btree (event_id);
1198
+ CREATE INDEX event_push_actions_stream_highlight_index ON event_push_actions USING btree (highlight, stream_ordering) WHERE (highlight = 0);
1199
+ CREATE INDEX event_push_actions_stream_ordering ON event_push_actions USING btree (stream_ordering, user_id);
1200
+ CREATE INDEX event_push_actions_u_highlight ON event_push_actions USING btree (user_id, stream_ordering);
1201
+ CREATE UNIQUE INDEX event_push_summary_unique_index ON event_push_summary USING btree (user_id, room_id);
1202
+ CREATE UNIQUE INDEX event_push_summary_unique_index2 ON event_push_summary USING btree (user_id, room_id, thread_id);
1203
+ CREATE UNIQUE INDEX event_relations_id ON event_relations USING btree (event_id);
1204
+ CREATE INDEX event_relations_relates ON event_relations USING btree (relates_to_id, relation_type, aggregation_key);
1205
+ CREATE INDEX event_search_ev_ridx ON event_search USING btree (room_id);
1206
+ CREATE UNIQUE INDEX event_search_event_id_idx ON event_search USING btree (event_id);
1207
+ CREATE INDEX event_search_fts_idx ON event_search USING gin (vector);
1208
+ CREATE INDEX event_to_state_groups_sg_index ON event_to_state_groups USING btree (state_group);
1209
+ CREATE UNIQUE INDEX event_txn_id_event_id ON event_txn_id USING btree (event_id);
1210
+ CREATE INDEX event_txn_id_ts ON event_txn_id USING btree (inserted_ts);
1211
+ CREATE UNIQUE INDEX event_txn_id_txn_id ON event_txn_id USING btree (room_id, user_id, token_id, txn_id);
1212
+ CREATE INDEX events_order_room ON events USING btree (room_id, topological_ordering, stream_ordering);
1213
+ CREATE INDEX events_room_stream ON events USING btree (room_id, stream_ordering);
1214
+ CREATE UNIQUE INDEX events_stream_ordering ON events USING btree (stream_ordering);
1215
+ CREATE INDEX events_ts ON events USING btree (origin_server_ts, stream_ordering);
1216
+ CREATE UNIQUE INDEX federation_inbound_events_staging_instance_event ON federation_inbound_events_staging USING btree (origin, event_id);
1217
+ CREATE INDEX federation_inbound_events_staging_room ON federation_inbound_events_staging USING btree (room_id, received_ts);
1218
+ CREATE UNIQUE INDEX federation_stream_position_instance ON federation_stream_position USING btree (type, instance_name);
1219
+ CREATE INDEX ignored_users_ignored_user_id ON ignored_users USING btree (ignored_user_id);
1220
+ CREATE UNIQUE INDEX ignored_users_uniqueness ON ignored_users USING btree (ignorer_user_id, ignored_user_id);
1221
+ CREATE INDEX insertion_event_edges_event_id ON insertion_event_edges USING btree (event_id);
1222
+ CREATE INDEX insertion_event_edges_insertion_prev_event_id ON insertion_event_edges USING btree (insertion_prev_event_id);
1223
+ CREATE INDEX insertion_event_edges_insertion_room_id ON insertion_event_edges USING btree (room_id);
1224
+ CREATE UNIQUE INDEX insertion_event_extremities_event_id ON insertion_event_extremities USING btree (event_id);
1225
+ CREATE INDEX insertion_event_extremities_room_id ON insertion_event_extremities USING btree (room_id);
1226
+ CREATE UNIQUE INDEX insertion_events_event_id ON insertion_events USING btree (event_id);
1227
+ CREATE INDEX insertion_events_next_batch_id ON insertion_events USING btree (next_batch_id);
1228
+ CREATE UNIQUE INDEX instance_map_idx ON instance_map USING btree (instance_name);
1229
+ CREATE UNIQUE INDEX local_current_membership_idx ON local_current_membership USING btree (user_id, room_id);
1230
+ CREATE INDEX local_current_membership_room_idx ON local_current_membership USING btree (room_id);
1231
+ CREATE UNIQUE INDEX local_media_repository_thumbn_media_id_width_height_method_key ON local_media_repository_thumbnails USING btree (media_id, thumbnail_width, thumbnail_height, thumbnail_type, thumbnail_method);
1232
+ CREATE INDEX local_media_repository_thumbnails_media_id ON local_media_repository_thumbnails USING btree (media_id);
1233
+ CREATE INDEX local_media_repository_url_cache_by_url_download_ts ON local_media_repository_url_cache USING btree (url, download_ts);
1234
+ CREATE INDEX local_media_repository_url_cache_expires_idx ON local_media_repository_url_cache USING btree (expires_ts);
1235
+ CREATE INDEX local_media_repository_url_cache_media_idx ON local_media_repository_url_cache USING btree (media_id);
1236
+ CREATE INDEX local_media_repository_url_idx ON local_media_repository USING btree (created_ts) WHERE (url_cache IS NOT NULL);
1237
+ CREATE INDEX monthly_active_users_time_stamp ON monthly_active_users USING btree ("timestamp");
1238
+ CREATE UNIQUE INDEX monthly_active_users_users ON monthly_active_users USING btree (user_id);
1239
+ CREATE INDEX open_id_tokens_ts_valid_until_ms ON open_id_tokens USING btree (ts_valid_until_ms);
1240
+ CREATE INDEX partial_state_events_room_id_idx ON partial_state_events USING btree (room_id);
1241
+ CREATE INDEX presence_stream_id ON presence_stream USING btree (stream_id, user_id);
1242
+ CREATE INDEX presence_stream_state_not_offline_idx ON presence_stream USING btree (state) WHERE (state <> 'offline'::text);
1243
+ CREATE INDEX presence_stream_user_id ON presence_stream USING btree (user_id);
1244
+ CREATE INDEX public_room_index ON rooms USING btree (is_public);
1245
+ CREATE INDEX push_rules_enable_user_name ON push_rules_enable USING btree (user_name);
1246
+ CREATE INDEX push_rules_stream_id ON push_rules_stream USING btree (stream_id);
1247
+ CREATE INDEX push_rules_stream_user_stream_id ON push_rules_stream USING btree (user_id, stream_id);
1248
+ CREATE INDEX push_rules_user_name ON push_rules USING btree (user_name);
1249
+ CREATE UNIQUE INDEX ratelimit_override_idx ON ratelimit_override USING btree (user_id);
1250
+ CREATE UNIQUE INDEX receipts_graph_unique_index ON receipts_graph USING btree (room_id, receipt_type, user_id) WHERE (thread_id IS NULL);
1251
+ CREATE INDEX receipts_linearized_id ON receipts_linearized USING btree (stream_id);
1252
+ CREATE INDEX receipts_linearized_room_stream ON receipts_linearized USING btree (room_id, stream_id);
1253
+ CREATE UNIQUE INDEX receipts_linearized_unique_index ON receipts_linearized USING btree (room_id, receipt_type, user_id) WHERE (thread_id IS NULL);
1254
+ CREATE INDEX receipts_linearized_user ON receipts_linearized USING btree (user_id);
1255
+ CREATE INDEX received_transactions_ts ON received_transactions USING btree (ts);
1256
+ CREATE INDEX redactions_have_censored_ts ON redactions USING btree (received_ts) WHERE (NOT have_censored);
1257
+ CREATE INDEX redactions_redacts ON redactions USING btree (redacts);
1258
+ CREATE INDEX refresh_tokens_next_token_id ON refresh_tokens USING btree (next_token_id) WHERE (next_token_id IS NOT NULL);
1259
+ CREATE UNIQUE INDEX remote_media_repository_thumbn_media_origin_id_width_height_met ON remote_media_cache_thumbnails USING btree (media_origin, media_id, thumbnail_width, thumbnail_height, thumbnail_type, thumbnail_method);
1260
+ CREATE INDEX room_account_data_stream_id ON room_account_data USING btree (user_id, stream_id);
1261
+ CREATE INDEX room_alias_servers_alias ON room_alias_servers USING btree (room_alias);
1262
+ CREATE INDEX room_aliases_id ON room_aliases USING btree (room_id);
1263
+ CREATE INDEX room_memberships_room_id ON room_memberships USING btree (room_id);
1264
+ CREATE INDEX room_memberships_user_id ON room_memberships USING btree (user_id);
1265
+ CREATE INDEX room_memberships_user_room_forgotten ON room_memberships USING btree (user_id, room_id) WHERE (forgotten = 1);
1266
+ CREATE INDEX room_retention_max_lifetime_idx ON room_retention USING btree (max_lifetime);
1267
+ CREATE UNIQUE INDEX room_stats_earliest_token_idx ON room_stats_earliest_token USING btree (room_id);
1268
+ CREATE UNIQUE INDEX room_stats_state_room ON room_stats_state USING btree (room_id);
1269
+ CREATE INDEX stream_ordering_to_exterm_idx ON stream_ordering_to_exterm USING btree (stream_ordering);
1270
+ CREATE INDEX stream_ordering_to_exterm_rm_idx ON stream_ordering_to_exterm USING btree (room_id, stream_ordering);
1271
+ CREATE UNIQUE INDEX stream_positions_idx ON stream_positions USING btree (stream_name, instance_name);
1272
+ CREATE UNIQUE INDEX threepid_guest_access_tokens_index ON threepid_guest_access_tokens USING btree (medium, address);
1273
+ CREATE INDEX threepid_validation_token_session_id ON threepid_validation_token USING btree (session_id);
1274
+ CREATE INDEX user_daily_visits_ts_idx ON user_daily_visits USING btree ("timestamp");
1275
+ CREATE INDEX user_daily_visits_uts_idx ON user_daily_visits USING btree (user_id, "timestamp");
1276
+ CREATE INDEX user_directory_room_idx ON user_directory USING btree (room_id);
1277
+ CREATE INDEX user_directory_search_fts_idx ON user_directory_search USING gin (vector);
1278
+ CREATE UNIQUE INDEX user_directory_search_user_idx ON user_directory_search USING btree (user_id);
1279
+ CREATE UNIQUE INDEX user_directory_user_idx ON user_directory USING btree (user_id);
1280
+ CREATE INDEX user_external_ids_user_id_idx ON user_external_ids USING btree (user_id);
1281
+ CREATE UNIQUE INDEX user_filters_unique ON user_filters USING btree (user_id, filter_id);
1282
+ CREATE INDEX user_ips_device_id ON user_ips USING btree (user_id, device_id, last_seen);
1283
+ CREATE INDEX user_ips_last_seen ON user_ips USING btree (user_id, last_seen);
1284
+ CREATE INDEX user_ips_last_seen_only ON user_ips USING btree (last_seen);
1285
+ CREATE UNIQUE INDEX user_ips_user_token_ip_unique_index ON user_ips USING btree (user_id, access_token, ip);
1286
+ CREATE UNIQUE INDEX user_signature_stream_idx ON user_signature_stream USING btree (stream_id);
1287
+ CREATE UNIQUE INDEX user_threepid_id_server_idx ON user_threepid_id_server USING btree (user_id, medium, address, id_server);
1288
+ CREATE INDEX user_threepids_medium_address ON user_threepids USING btree (medium, address);
1289
+ CREATE INDEX user_threepids_user_id ON user_threepids USING btree (user_id);
1290
+ CREATE INDEX users_creation_ts ON users USING btree (creation_ts);
1291
+ CREATE INDEX users_have_local_media ON local_media_repository USING btree (user_id, created_ts);
1292
+ CREATE INDEX users_in_public_rooms_r_idx ON users_in_public_rooms USING btree (room_id);
1293
+ CREATE UNIQUE INDEX users_in_public_rooms_u_idx ON users_in_public_rooms USING btree (user_id, room_id);
1294
+ CREATE INDEX users_who_share_private_rooms_o_idx ON users_who_share_private_rooms USING btree (other_user_id);
1295
+ CREATE INDEX users_who_share_private_rooms_r_idx ON users_who_share_private_rooms USING btree (room_id);
1296
+ CREATE UNIQUE INDEX users_who_share_private_rooms_u_idx ON users_who_share_private_rooms USING btree (user_id, other_user_id, room_id);
1297
+ CREATE UNIQUE INDEX worker_locks_key ON worker_locks USING btree (lock_name, lock_key);
1298
+ CREATE TRIGGER check_partial_state_events BEFORE INSERT OR UPDATE ON partial_state_events FOR EACH ROW EXECUTE PROCEDURE check_partial_state_events();
1299
+ ALTER TABLE ONLY access_tokens
1300
+ ADD CONSTRAINT access_tokens_refresh_token_id_fkey FOREIGN KEY (refresh_token_id) REFERENCES refresh_tokens(id) ON DELETE CASCADE;
1301
+ ALTER TABLE ONLY destination_rooms
1302
+ ADD CONSTRAINT destination_rooms_destination_fkey FOREIGN KEY (destination) REFERENCES destinations(destination);
1303
+ ALTER TABLE ONLY destination_rooms
1304
+ ADD CONSTRAINT destination_rooms_room_id_fkey FOREIGN KEY (room_id) REFERENCES rooms(room_id);
1305
+ ALTER TABLE ONLY event_edges
1306
+ ADD CONSTRAINT event_edges_event_id_fkey FOREIGN KEY (event_id) REFERENCES events(event_id);
1307
+ ALTER TABLE ONLY event_txn_id
1308
+ ADD CONSTRAINT event_txn_id_event_id_fkey FOREIGN KEY (event_id) REFERENCES events(event_id) ON DELETE CASCADE;
1309
+ ALTER TABLE ONLY event_txn_id
1310
+ ADD CONSTRAINT event_txn_id_token_id_fkey FOREIGN KEY (token_id) REFERENCES access_tokens(id) ON DELETE CASCADE;
1311
+ ALTER TABLE ONLY partial_state_events
1312
+ ADD CONSTRAINT partial_state_events_event_id_fkey FOREIGN KEY (event_id) REFERENCES events(event_id);
1313
+ ALTER TABLE ONLY partial_state_events
1314
+ ADD CONSTRAINT partial_state_events_room_id_fkey FOREIGN KEY (room_id) REFERENCES partial_state_rooms(room_id);
1315
+ ALTER TABLE ONLY partial_state_rooms
1316
+ ADD CONSTRAINT partial_state_rooms_room_id_fkey FOREIGN KEY (room_id) REFERENCES rooms(room_id);
1317
+ ALTER TABLE ONLY partial_state_rooms_servers
1318
+ ADD CONSTRAINT partial_state_rooms_servers_room_id_fkey FOREIGN KEY (room_id) REFERENCES partial_state_rooms(room_id);
1319
+ ALTER TABLE ONLY refresh_tokens
1320
+ ADD CONSTRAINT refresh_tokens_next_token_id_fkey FOREIGN KEY (next_token_id) REFERENCES refresh_tokens(id) ON DELETE CASCADE;
1321
+ ALTER TABLE ONLY ui_auth_sessions_credentials
1322
+ ADD CONSTRAINT ui_auth_sessions_credentials_session_id_fkey FOREIGN KEY (session_id) REFERENCES ui_auth_sessions(session_id);
1323
+ ALTER TABLE ONLY ui_auth_sessions_ips
1324
+ ADD CONSTRAINT ui_auth_sessions_ips_session_id_fkey FOREIGN KEY (session_id) REFERENCES ui_auth_sessions(session_id);
1325
+ ALTER TABLE ONLY users_to_send_full_presence_to
1326
+ ADD CONSTRAINT users_to_send_full_presence_to_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(name);
1327
+ INSERT INTO appservice_stream_position VALUES ('X', 0);
1328
+ INSERT INTO event_push_summary_last_receipt_stream_id VALUES ('X', 0);
1329
+ INSERT INTO event_push_summary_stream_ordering VALUES ('X', 0);
1330
+ INSERT INTO federation_stream_position VALUES ('federation', -1, 'master');
1331
+ INSERT INTO federation_stream_position VALUES ('events', -1, 'master');
1332
+ INSERT INTO stats_incremental_position VALUES ('X', 1);
1333
+ INSERT INTO user_directory_stream_pos VALUES ('X', 1);
1334
+ SELECT pg_catalog.setval('account_data_sequence', 1, true);
1335
+ SELECT pg_catalog.setval('application_services_txn_id_seq', 1, false);
1336
+ SELECT pg_catalog.setval('cache_invalidation_stream_seq', 1, true);
1337
+ SELECT pg_catalog.setval('device_inbox_sequence', 1, true);
1338
+ SELECT pg_catalog.setval('event_auth_chain_id', 1, false);
1339
+ SELECT pg_catalog.setval('events_backfill_stream_seq', 1, true);
1340
+ SELECT pg_catalog.setval('events_stream_seq', 1, true);
1341
+ SELECT pg_catalog.setval('instance_map_instance_id_seq', 1, false);
1342
+ SELECT pg_catalog.setval('presence_stream_sequence', 1, true);
1343
+ SELECT pg_catalog.setval('receipts_sequence', 1, true);
1344
+ SELECT pg_catalog.setval('user_id_seq', 1, false);