mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
push_rules table expects an 'id' field
This commit is contained in:
parent
2640d6718d
commit
cd525c0f5a
@ -308,6 +308,7 @@ class SQLBaseStore(object):
|
||||
self._state_groups_id_gen = IdGenerator("state_groups", "id", self)
|
||||
self._access_tokens_id_gen = IdGenerator("access_tokens", "id", self)
|
||||
self._pushers_id_gen = IdGenerator("pushers", "id", self)
|
||||
self._push_rule_id_gen = IdGenerator("push_rules", "id", self)
|
||||
|
||||
def start_profiling(self):
|
||||
self._previous_loop_ts = self._clock.time_msec()
|
||||
|
@ -120,6 +120,7 @@ class PushRuleStore(SQLBaseStore):
|
||||
del new_rule['after']
|
||||
new_rule['priority_class'] = priority_class
|
||||
new_rule['user_name'] = user_name
|
||||
new_rule['id'] = self._push_rule_id_gen.get_next_txn(txn)
|
||||
|
||||
# check if the priority before/after is free
|
||||
new_rule_priority = base_rule_priority
|
||||
@ -153,12 +154,11 @@ class PushRuleStore(SQLBaseStore):
|
||||
|
||||
txn.execute(sql, (user_name, priority_class, new_rule_priority))
|
||||
|
||||
# now insert the new rule
|
||||
sql = "INSERT INTO "+PushRuleTable.table_name+" ("
|
||||
sql += ",".join(new_rule.keys())+") VALUES ("
|
||||
sql += ", ".join(["?" for _ in new_rule.keys()])+")"
|
||||
|
||||
txn.execute(sql, new_rule.values())
|
||||
self._simple_insert_txn(
|
||||
txn,
|
||||
table=PushRuleTable.table_name,
|
||||
values=new_rule,
|
||||
)
|
||||
|
||||
def _add_push_rule_highest_priority_txn(self, txn, user_name,
|
||||
priority_class, **kwargs):
|
||||
@ -177,17 +177,16 @@ class PushRuleStore(SQLBaseStore):
|
||||
|
||||
# and insert the new rule
|
||||
new_rule = copy.copy(kwargs)
|
||||
if 'id' in new_rule:
|
||||
del new_rule['id']
|
||||
new_rule['id'] = self._push_rule_id_gen.get_next_txn(txn)
|
||||
new_rule['user_name'] = user_name
|
||||
new_rule['priority_class'] = priority_class
|
||||
new_rule['priority'] = new_prio
|
||||
|
||||
sql = "INSERT INTO "+PushRuleTable.table_name+" ("
|
||||
sql += ",".join(new_rule.keys())+") VALUES ("
|
||||
sql += ", ".join(["?" for _ in new_rule.keys()])+")"
|
||||
|
||||
txn.execute(sql, new_rule.values())
|
||||
self._simple_insert_txn(
|
||||
txn,
|
||||
table=PushRuleTable.table_name,
|
||||
values=new_rule,
|
||||
)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def delete_push_rule(self, user_name, rule_id):
|
||||
|
Loading…
Reference in New Issue
Block a user