aboutsummaryrefslogtreecommitdiffstats
path: root/pysite
diff options
context:
space:
mode:
Diffstat (limited to 'pysite')
-rw-r--r--pysite/migrations/tables/oauth_data/__init__.py0
-rw-r--r--pysite/migrations/tables/oauth_data/v1.py3
-rw-r--r--pysite/views/api/bot/user.py4
3 files changed, 5 insertions, 2 deletions
diff --git a/pysite/migrations/tables/oauth_data/__init__.py b/pysite/migrations/tables/oauth_data/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/pysite/migrations/tables/oauth_data/__init__.py
diff --git a/pysite/migrations/tables/oauth_data/v1.py b/pysite/migrations/tables/oauth_data/v1.py
new file mode 100644
index 00000000..8448d8e5
--- /dev/null
+++ b/pysite/migrations/tables/oauth_data/v1.py
@@ -0,0 +1,3 @@
+def run(db, table, table_obj):
+ db.run(db.query(table).index_create("snowflake"))
+ db.run(db.query(table).index_wait("snowflake"))
diff --git a/pysite/views/api/bot/user.py b/pysite/views/api/bot/user.py
index 077991f5..58963682 100644
--- a/pysite/views/api/bot/user.py
+++ b/pysite/views/api/bot/user.py
@@ -52,7 +52,7 @@ class UserView(APIView, DBMixin):
all_oauth_data = self.db.run(self.db.query(self.oauth_table_name), coerce=list)
for item in all_oauth_data:
- if item["id"] not in user_ids:
+ if item["snowflake"] not in user_ids:
self.db.delete(self.oauth_table_name, item["id"], durability="soft")
oauth_deletions += 1
@@ -94,7 +94,7 @@ class UserView(APIView, DBMixin):
oauth_deletions = self.db.run(
self.db.query(self.oauth_table_name)
- .get_all(*user_ids)
+ .get_all(*user_ids, index="snowflake")
.delete()
).get("deleted", 0)