mirror of
https://github.com/element-hq/synapse
synced 2024-08-19 06:50:52 +00:00
pep8
This commit is contained in:
parent
42c89c8215
commit
006e18b6bb
1 changed files with 5 additions and 3 deletions
|
@ -32,23 +32,25 @@ DROP INDEX groups_rooms_r_idx;
|
||||||
CREATE INDEX group_rooms_r_idx ON group_rooms(room_id);
|
CREATE INDEX group_rooms_r_idx ON group_rooms(room_id);
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def run_create(cur, database_engine, *args, **kwargs):
|
def run_create(cur, database_engine, *args, **kwargs):
|
||||||
rowid = "ctid" if isinstance(database_engine, PostgresEngine) then "rowid"
|
rowid = "ctid" if isinstance(database_engine, PostgresEngine) else "rowid"
|
||||||
|
|
||||||
# remove duplicates from group_users & group_invites tables
|
# remove duplicates from group_users & group_invites tables
|
||||||
cur.execute("""
|
cur.execute("""
|
||||||
DELETE FROM group_users WHERE %s NOT IN (
|
DELETE FROM group_users WHERE %s NOT IN (
|
||||||
SELECT min(%s) FROM group_users GROUP BY group_id, user_id
|
SELECT min(%s) FROM group_users GROUP BY group_id, user_id
|
||||||
);
|
);
|
||||||
""" % (rowid, rowid));
|
""" % (rowid, rowid))
|
||||||
cur.execute("""
|
cur.execute("""
|
||||||
DELETE FROM group_invites WHERE %s NOT IN (
|
DELETE FROM group_invites WHERE %s NOT IN (
|
||||||
SELECT min(%s) FROM group_invites GROUP BY group_id, user_id
|
SELECT min(%s) FROM group_invites GROUP BY group_id, user_id
|
||||||
);
|
);
|
||||||
""" % (rowid, rowid));
|
""" % (rowid, rowid))
|
||||||
|
|
||||||
for statement in get_statements(FIX_INDEXES.splitlines()):
|
for statement in get_statements(FIX_INDEXES.splitlines()):
|
||||||
cur.execute(statement)
|
cur.execute(statement)
|
||||||
|
|
||||||
|
|
||||||
def run_upgrade(*args, **kwargs):
|
def run_upgrade(*args, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue