summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/__init__.py3
-rw-r--r--synapse/storage/schema/delta/v10.sql13
-rw-r--r--synapse/storage/schema/pusher.sql13
3 files changed, 29 insertions, 0 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index 191fe462a5..11706676d0 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -30,6 +30,7 @@ from .transactions import TransactionStore
 from .keys import KeyStore
 from .event_federation import EventFederationStore
 from .pusher import PusherStore
+from .push_rule import PushRuleStore
 from .media_repository import MediaRepositoryStore
 
 from .state import StateStore
@@ -62,6 +63,7 @@ SCHEMAS = [
     "event_edges",
     "event_signatures",
     "pusher",
+    "push_rules",
     "media_repository",
 ]
 
@@ -85,6 +87,7 @@ class DataStore(RoomMemberStore, RoomStore,
                 EventFederationStore,
                 MediaRepositoryStore,
                 PusherStore,
+                PushRuleStore
                 ):
 
     def __init__(self, hs):
diff --git a/synapse/storage/schema/delta/v10.sql b/synapse/storage/schema/delta/v10.sql
index b84ce20ef3..8c4dfd5c1b 100644
--- a/synapse/storage/schema/delta/v10.sql
+++ b/synapse/storage/schema/delta/v10.sql
@@ -31,3 +31,16 @@ CREATE TABLE IF NOT EXISTS pushers (
   FOREIGN KEY(user_name) REFERENCES users(name),
   UNIQUE (app_id, pushkey)
 );
+
+CREATE TABLE IF NOT EXISTS push_rules (
+  id INTEGER PRIMARY KEY AUTOINCREMENT,
+  user_name TEXT NOT NULL,
+  rule_id TEXT NOT NULL,
+  priority_class TINYINT NOT NULL,
+  priority INTEGER NOT NULL DEFAULT 0,
+  conditions TEXT NOT NULL,
+  actions TEXT NOT NULL,
+  UNIQUE(user_name, rule_id)
+);
+
+CREATE INDEX IF NOT EXISTS push_rules_user_name on push_rules (user_name);
diff --git a/synapse/storage/schema/pusher.sql b/synapse/storage/schema/pusher.sql
index b84ce20ef3..8c4dfd5c1b 100644
--- a/synapse/storage/schema/pusher.sql
+++ b/synapse/storage/schema/pusher.sql
@@ -31,3 +31,16 @@ CREATE TABLE IF NOT EXISTS pushers (
   FOREIGN KEY(user_name) REFERENCES users(name),
   UNIQUE (app_id, pushkey)
 );
+
+CREATE TABLE IF NOT EXISTS push_rules (
+  id INTEGER PRIMARY KEY AUTOINCREMENT,
+  user_name TEXT NOT NULL,
+  rule_id TEXT NOT NULL,
+  priority_class TINYINT NOT NULL,
+  priority INTEGER NOT NULL DEFAULT 0,
+  conditions TEXT NOT NULL,
+  actions TEXT NOT NULL,
+  UNIQUE(user_name, rule_id)
+);
+
+CREATE INDEX IF NOT EXISTS push_rules_user_name on push_rules (user_name);