core-framework 0.3.0__py3-none-any.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.
- core_framework/__init__.py +0 -0
- core_framework/alembic/comment/alembic/README +1 -0
- core_framework/alembic/comment/alembic/env.py +72 -0
- core_framework/alembic/comment/alembic/script.py.mako +28 -0
- core_framework/alembic/comment/alembic/versions/30334fd1347b_init.py +59 -0
- core_framework/alembic/comment/alembic/versions/a2b3c4d5e6f7_improve_comment_indexes.py +54 -0
- core_framework/alembic/comment/alembic/versions/bcc8e00cfc8b_add_extra_tables.py +64 -0
- core_framework/alembic/comment/alembic/versions/d1e2f3a4b5c6_add_comment_stats_dirty_table.py +29 -0
- core_framework/alembic/comment/alembic/versions/e3f4a5b6c7d8_cascade_delete_comment_descendants.py +49 -0
- core_framework/alembic/comment/alembic/versions/f7e6d5c4b3a2_comments_path_to_ltree.py +60 -0
- core_framework/alembic/comment/alembic.ini +52 -0
- core_framework/alembic/extension/alembic/README +1 -0
- core_framework/alembic/extension/alembic/env.py +98 -0
- core_framework/alembic/extension/alembic/script.py.mako +28 -0
- core_framework/alembic/extension/alembic/versions/0389226049cb_add_pg_trgm_extension.py +25 -0
- core_framework/alembic/extension/alembic/versions/5dc58b016cf5_add_citext_extension.py +25 -0
- core_framework/alembic/extension/alembic/versions/b0ba0d8a284e_add_pg_stat_statements_extension.py +25 -0
- core_framework/alembic/extension/alembic/versions/c9d0e1f2a3b4_add_ltree_extension.py +25 -0
- core_framework/alembic/extension/alembic.ini +147 -0
- core_framework/alembic/moderation/alembic/README +1 -0
- core_framework/alembic/moderation/alembic/env.py +98 -0
- core_framework/alembic/moderation/alembic/script.py.mako +28 -0
- core_framework/alembic/moderation/alembic/versions/085ba9021850_add_category_to_user_restrictions.py +93 -0
- core_framework/alembic/moderation/alembic/versions/5f9e4fc14a41_create_moderation_appeals_table.py +69 -0
- core_framework/alembic/moderation/alembic/versions/63e37381e73b_add_user_reports_table.py +33 -0
- core_framework/alembic/moderation/alembic/versions/6a2ae31b7ac6_add_moderation_actions_table.py +34 -0
- core_framework/alembic/moderation/alembic/versions/716aa1735c03_improve_indexes.py +36 -0
- core_framework/alembic/moderation/alembic/versions/7d243ddbfde1_add_post_reports_table.py +35 -0
- core_framework/alembic/moderation/alembic/versions/8fba1f72dd46_add_indexes.py +64 -0
- core_framework/alembic/moderation/alembic/versions/95cc35a51984_update_restriction_history.py +91 -0
- core_framework/alembic/moderation/alembic/versions/9ad79d0af730_add_unique_constraint_user_reports_.py +28 -0
- core_framework/alembic/moderation/alembic/versions/a5e569f5df1a_create_user_restrictions_table.py +38 -0
- core_framework/alembic/moderation/alembic/versions/b2c3d4e5f6a7_add_indexes.py +42 -0
- core_framework/alembic/moderation/alembic/versions/c3d4e5f6a7b8_improve_report_indexes.py +48 -0
- core_framework/alembic/moderation/alembic/versions/d4af74643ff5_add_internal_notes_table.py +38 -0
- core_framework/alembic/moderation/alembic/versions/db20f2fb7390_add_comment_reports_table.py +35 -0
- core_framework/alembic/moderation/alembic/versions/e66226952ea6_add_report_category_to_user_reports_.py +54 -0
- core_framework/alembic/moderation/alembic/versions/f5e8cb275c30_enforce_1_pending_appeal.py +29 -0
- core_framework/alembic/moderation/alembic/versions/fe1faad2832d_create_restriction_history_table.py +69 -0
- core_framework/alembic/moderation/alembic.ini +147 -0
- core_framework/alembic/post/alembic/README +1 -0
- core_framework/alembic/post/alembic/env.py +97 -0
- core_framework/alembic/post/alembic/script.py.mako +28 -0
- core_framework/alembic/post/alembic/versions/51542673f5c8_add_tables_for_muted_banned_users.py +41 -0
- core_framework/alembic/post/alembic/versions/5beeeae40a4a_add_post_views_table.py +45 -0
- core_framework/alembic/post/alembic/versions/620971509a8b_init.py +55 -0
- core_framework/alembic/post/alembic/versions/a1b2c3d4e5f6_add_indexes.py +44 -0
- core_framework/alembic/post/alembic/versions/c1d2e3f4a5b6_add_post_hashtags_table.py +36 -0
- core_framework/alembic/post/alembic/versions/e56723f2afff_add_post_stats_table.py +39 -0
- core_framework/alembic/post/alembic/versions/fbc723ac58cc_add_post_likes_table.py +32 -0
- core_framework/alembic/post/alembic.ini +149 -0
- core_framework/alembic/user/alembic/README +1 -0
- core_framework/alembic/user/alembic/env.py +98 -0
- core_framework/alembic/user/alembic/script.py.mako +28 -0
- core_framework/alembic/user/alembic/versions/1a8bb99726ed_remove_avatar_id_from_users.py +81 -0
- core_framework/alembic/user/alembic/versions/2ccacf455941_improve_indexes.py +34 -0
- core_framework/alembic/user/alembic/versions/47f47ce2110e_create_user_deletions_table.py +31 -0
- core_framework/alembic/user/alembic/versions/5976db3f0175_drop_user_states.py +26 -0
- core_framework/alembic/user/alembic/versions/62417002cf32_add_indexes.py +46 -0
- core_framework/alembic/user/alembic/versions/6f7ccf3c226b_refactor_user_login_events.py +66 -0
- core_framework/alembic/user/alembic/versions/73432817015b_add_user_preferences_table.py +33 -0
- core_framework/alembic/user/alembic/versions/765bc01a7a59_create_user_blocks_table.py +33 -0
- core_framework/alembic/user/alembic/versions/7a56631f9927_create_user_login_events_table.py +49 -0
- core_framework/alembic/user/alembic/versions/831611e589bc_create_user_state.py +31 -0
- core_framework/alembic/user/alembic/versions/83c98ab2a779_add_user_profiles_table.py +88 -0
- core_framework/alembic/user/alembic/versions/8a94362cad6d_create_user_role.py +31 -0
- core_framework/alembic/user/alembic/versions/94b973923895_add_user_change_history_table.py +97 -0
- core_framework/alembic/user/alembic/versions/cbc0f4efe84f_add_avatar_id_column_to_users_table.py +31 -0
- core_framework/alembic/user/alembic/versions/d8b98ac6b073_add_index_for_get_admin_user_ids_query.py +29 -0
- core_framework/alembic/user/alembic/versions/ddb70cc09d16_create_user_states_table.py +34 -0
- core_framework/alembic/user/alembic/versions/f9ba10815ecd_add_users_table.py +33 -0
- core_framework/alembic/user/alembic.ini +147 -0
- core_framework/api/__init__.py +0 -0
- core_framework/api/admin/__init__.py +0 -0
- core_framework/api/admin/comments/router.py +69 -0
- core_framework/api/admin/comments/schemas.py +53 -0
- core_framework/api/admin/moderation/__init__.py +0 -0
- core_framework/api/admin/moderation/router.py +205 -0
- core_framework/api/admin/moderation/schemas.py +110 -0
- core_framework/api/admin/posts/router.py +62 -0
- core_framework/api/admin/posts/schemas.py +29 -0
- core_framework/api/admin/router.py +17 -0
- core_framework/api/admin/users/__init__.py +0 -0
- core_framework/api/admin/users/router.py +181 -0
- core_framework/api/admin/users/schemas.py +137 -0
- core_framework/api/auth/__init__.py +0 -0
- core_framework/api/auth/router.py +21 -0
- core_framework/api/auth/schemas.py +28 -0
- core_framework/api/comments/authenticated/router.py +126 -0
- core_framework/api/comments/authenticated/schemas.py +27 -0
- core_framework/api/comments/public/router.py +103 -0
- core_framework/api/comments/public/schemas.py +36 -0
- core_framework/api/comments/router.py +9 -0
- core_framework/api/comments/schemas.py +17 -0
- core_framework/api/dependencies.py +168 -0
- core_framework/api/events/router.py +39 -0
- core_framework/api/events/schemas.py +20 -0
- core_framework/api/posts/authenticated/router.py +83 -0
- core_framework/api/posts/authenticated/schemas.py +37 -0
- core_framework/api/posts/public/router.py +100 -0
- core_framework/api/posts/public/schemas.py +39 -0
- core_framework/api/posts/router.py +9 -0
- core_framework/api/posts/schemas.py +39 -0
- core_framework/api/router.py +19 -0
- core_framework/api/schemas.py +9 -0
- core_framework/api/system/__init__.py +0 -0
- core_framework/api/system/router.py +108 -0
- core_framework/api/users/__init__.py +0 -0
- core_framework/api/users/authenticated/__init__.py +0 -0
- core_framework/api/users/authenticated/router.py +244 -0
- core_framework/api/users/authenticated/schemas.py +81 -0
- core_framework/api/users/public/__init__.py +0 -0
- core_framework/api/users/public/router.py +25 -0
- core_framework/api/users/public/schemas.py +7 -0
- core_framework/api/users/router.py +9 -0
- core_framework/api/users/shared/schemas.py +174 -0
- core_framework/application/__init__.py +0 -0
- core_framework/application/auth/__init__.py +0 -0
- core_framework/application/auth/access_service.py +26 -0
- core_framework/application/auth/auth_service.py +10 -0
- core_framework/application/auth/models.py +10 -0
- core_framework/application/bootstrap.py +19 -0
- core_framework/application/comments/admin_service.py +236 -0
- core_framework/application/comments/aggregation_service.py +28 -0
- core_framework/application/comments/authenticated_service.py +89 -0
- core_framework/application/comments/public_service.py +218 -0
- core_framework/application/events/README.md +26 -0
- core_framework/application/events/event_service.py +51 -0
- core_framework/application/events/event_token.py +46 -0
- core_framework/application/events/models.py +9 -0
- core_framework/application/moderation/__init__.py +0 -0
- core_framework/application/moderation/appeal_service.py +98 -0
- core_framework/application/moderation/moderator_service.py +46 -0
- core_framework/application/moderation/report_service.py +180 -0
- core_framework/application/moderation/scheduled_service.py +5 -0
- core_framework/application/moderation/user_service.py +180 -0
- core_framework/application/posts/admin_service.py +104 -0
- core_framework/application/posts/aggregation_service.py +28 -0
- core_framework/application/posts/authenticated_service.py +72 -0
- core_framework/application/posts/public_service.py +197 -0
- core_framework/application/shared/__init__.py +0 -0
- core_framework/application/shared/enums.py +16 -0
- core_framework/application/shared/exceptions.py +16 -0
- core_framework/application/shared/user_agent.py +24 -0
- core_framework/application/users/__init__.py +0 -0
- core_framework/application/users/admin_service.py +298 -0
- core_framework/application/users/authenticated_service.py +179 -0
- core_framework/application/users/public_service.py +7 -0
- core_framework/application/users/scheduled_service.py +5 -0
- core_framework/bundled_alembic.py +57 -0
- core_framework/core/__init__.py +37 -0
- core_framework/core/cache.py +234 -0
- core_framework/core/context.py +14 -0
- core_framework/core/database.py +111 -0
- core_framework/core/exception_handlers/__init__.py +3 -0
- core_framework/core/exception_handlers/comment.py +99 -0
- core_framework/core/exception_handlers/common.py +5 -0
- core_framework/core/exception_handlers/moderation.py +104 -0
- core_framework/core/exception_handlers/post.py +54 -0
- core_framework/core/exception_handlers/setup.py +80 -0
- core_framework/core/exception_handlers/user.py +72 -0
- core_framework/core/http_client.py +64 -0
- core_framework/core/logging.py +99 -0
- core_framework/core/middleware.py +64 -0
- core_framework/core/observability.py +36 -0
- core_framework/core/pagination.py +203 -0
- core_framework/core/redis.py +135 -0
- core_framework/core/runtime.py +66 -0
- core_framework/core/settings.py +189 -0
- core_framework/domains/__init__.py +0 -0
- core_framework/domains/comment/README.md +243 -0
- core_framework/domains/comment/__init__.py +25 -0
- core_framework/domains/comment/constants.py +3 -0
- core_framework/domains/comment/dependencies.py +29 -0
- core_framework/domains/comment/enums.py +11 -0
- core_framework/domains/comment/exceptions.py +31 -0
- core_framework/domains/comment/models.py +54 -0
- core_framework/domains/comment/repository.py +947 -0
- core_framework/domains/comment/service.py +259 -0
- core_framework/domains/moderation/README.md +138 -0
- core_framework/domains/moderation/__init__.py +47 -0
- core_framework/domains/moderation/dependencies.py +29 -0
- core_framework/domains/moderation/enums.py +62 -0
- core_framework/domains/moderation/exceptions.py +31 -0
- core_framework/domains/moderation/models.py +94 -0
- core_framework/domains/moderation/repository.py +828 -0
- core_framework/domains/moderation/service.py +334 -0
- core_framework/domains/post/README.md +182 -0
- core_framework/domains/post/__init__.py +22 -0
- core_framework/domains/post/constants.py +3 -0
- core_framework/domains/post/dependencies.py +29 -0
- core_framework/domains/post/enums.py +18 -0
- core_framework/domains/post/exceptions.py +21 -0
- core_framework/domains/post/models.py +53 -0
- core_framework/domains/post/repository.py +791 -0
- core_framework/domains/post/service.py +204 -0
- core_framework/domains/user/README.md +74 -0
- core_framework/domains/user/__init__.py +39 -0
- core_framework/domains/user/constants.py +8 -0
- core_framework/domains/user/dependencies.py +29 -0
- core_framework/domains/user/enums.py +19 -0
- core_framework/domains/user/exceptions.py +31 -0
- core_framework/domains/user/models.py +124 -0
- core_framework/domains/user/repository.py +612 -0
- core_framework/domains/user/service.py +257 -0
- core_framework/domains/user/utils.py +182 -0
- core_framework/main.py +104 -0
- core_framework/worker/__init__.py +0 -0
- core_framework/worker/main.py +56 -0
- core_framework/worker/schedules/__init__.py +35 -0
- core_framework/worker/schedules/schedule_aggregate_comment_stats.py +32 -0
- core_framework/worker/schedules/schedule_aggregate_post_view_counts.py +28 -0
- core_framework/worker/schedules/schedule_expired_account_deletions.py +24 -0
- core_framework/worker/schedules/schedule_expired_mute_lifts.py +24 -0
- core_framework/worker/tasks/__init__.py +11 -0
- core_framework/worker/tasks/process_account_deletion.py +13 -0
- core_framework/worker/tasks/process_aggregate_comment_stats.py +19 -0
- core_framework/worker/tasks/process_aggregate_post_stats.py +12 -0
- core_framework/worker/tasks/process_mute_lift.py +13 -0
- core_framework-0.3.0.dist-info/METADATA +22 -0
- core_framework-0.3.0.dist-info/RECORD +222 -0
- core_framework-0.3.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""add ltree extension
|
|
2
|
+
|
|
3
|
+
Revision ID: c9d0e1f2a3b4
|
|
4
|
+
Revises: 0389226049cb
|
|
5
|
+
Create Date: 2026-03-19 12:00:00.000000
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from collections.abc import Sequence
|
|
10
|
+
|
|
11
|
+
from alembic import op
|
|
12
|
+
|
|
13
|
+
# revision identifiers, used by Alembic.
|
|
14
|
+
revision: str = "c9d0e1f2a3b4"
|
|
15
|
+
down_revision: str | Sequence[str] | None = "0389226049cb"
|
|
16
|
+
branch_labels: str | Sequence[str] | None = None
|
|
17
|
+
depends_on: str | Sequence[str] | None = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade() -> None:
|
|
21
|
+
op.execute("create extension if not exists ltree")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def downgrade() -> None:
|
|
25
|
+
op.execute("drop extension if exists ltree")
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# A generic, single database configuration.
|
|
2
|
+
|
|
3
|
+
[alembic]
|
|
4
|
+
# path to migration scripts.
|
|
5
|
+
# this is typically a path given in POSIX (e.g. forward slashes)
|
|
6
|
+
# format, relative to the token %(here)s which refers to the location of this
|
|
7
|
+
# ini file
|
|
8
|
+
script_location = %(here)s/alembic
|
|
9
|
+
|
|
10
|
+
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
|
|
11
|
+
# Uncomment the line below if you want the files to be prepended with date and time
|
|
12
|
+
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
|
|
13
|
+
# for all available tokens
|
|
14
|
+
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
|
|
15
|
+
|
|
16
|
+
# sys.path path, will be prepended to sys.path if present.
|
|
17
|
+
# defaults to the current working directory. for multiple paths, the path separator
|
|
18
|
+
# is defined by "path_separator" below.
|
|
19
|
+
prepend_sys_path = .
|
|
20
|
+
|
|
21
|
+
# timezone to use when rendering the date within the migration file
|
|
22
|
+
# as well as the filename.
|
|
23
|
+
# If specified, requires the tzdata library which can be installed by adding
|
|
24
|
+
# `alembic[tz]` to the pip requirements.
|
|
25
|
+
# string value is passed to ZoneInfo()
|
|
26
|
+
# leave blank for localtime
|
|
27
|
+
# timezone =
|
|
28
|
+
|
|
29
|
+
# max length of characters to apply to the "slug" field
|
|
30
|
+
# truncate_slug_length = 40
|
|
31
|
+
|
|
32
|
+
# set to 'true' to run the environment during
|
|
33
|
+
# the 'revision' command, regardless of autogenerate
|
|
34
|
+
# revision_environment = false
|
|
35
|
+
|
|
36
|
+
# set to 'true' to allow .pyc and .pyo files without
|
|
37
|
+
# a source .py file to be detected as revisions in the
|
|
38
|
+
# versions/ directory
|
|
39
|
+
# sourceless = false
|
|
40
|
+
|
|
41
|
+
# version location specification; This defaults
|
|
42
|
+
# to <script_location>/versions. When using multiple version
|
|
43
|
+
# directories, initial revisions must be specified with --version-path.
|
|
44
|
+
# The path separator used here should be the separator specified by "path_separator"
|
|
45
|
+
# below.
|
|
46
|
+
# version_locations = %(here)s/bar:%(here)s/bat:%(here)s/alembic/versions
|
|
47
|
+
|
|
48
|
+
# path_separator; This indicates what character is used to split lists of file
|
|
49
|
+
# paths, including version_locations and prepend_sys_path within configparser
|
|
50
|
+
# files such as alembic.ini.
|
|
51
|
+
# The default rendered in new alembic.ini files is "os", which uses os.pathsep
|
|
52
|
+
# to provide os-dependent path splitting.
|
|
53
|
+
#
|
|
54
|
+
# Note that in order to support legacy alembic.ini files, this default does NOT
|
|
55
|
+
# take place if path_separator is not present in alembic.ini. If this
|
|
56
|
+
# option is omitted entirely, fallback logic is as follows:
|
|
57
|
+
#
|
|
58
|
+
# 1. Parsing of the version_locations option falls back to using the legacy
|
|
59
|
+
# "version_path_separator" key, which if absent then falls back to the legacy
|
|
60
|
+
# behavior of splitting on spaces and/or commas.
|
|
61
|
+
# 2. Parsing of the prepend_sys_path option falls back to the legacy
|
|
62
|
+
# behavior of splitting on spaces, commas, or colons.
|
|
63
|
+
#
|
|
64
|
+
# Valid values for path_separator are:
|
|
65
|
+
#
|
|
66
|
+
# path_separator = :
|
|
67
|
+
# path_separator = ;
|
|
68
|
+
# path_separator = space
|
|
69
|
+
# path_separator = newline
|
|
70
|
+
#
|
|
71
|
+
# Use os.pathsep. Default configuration used for new projects.
|
|
72
|
+
path_separator = os
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# set to 'true' to search source files recursively
|
|
76
|
+
# in each "version_locations" directory
|
|
77
|
+
# new in Alembic version 1.10
|
|
78
|
+
# recursive_version_locations = false
|
|
79
|
+
|
|
80
|
+
# the output encoding used when revision files
|
|
81
|
+
# are written from script.py.mako
|
|
82
|
+
# output_encoding = utf-8
|
|
83
|
+
|
|
84
|
+
# database URL. This is consumed by the user-maintained env.py script only.
|
|
85
|
+
# other means of configuring database URLs may be customized within the env.py
|
|
86
|
+
# file.
|
|
87
|
+
sqlalchemy.url = driver://user:pass@localhost/dbname
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
[post_write_hooks]
|
|
91
|
+
# post_write_hooks defines scripts or Python functions that are run
|
|
92
|
+
# on newly generated revision scripts. See the documentation for further
|
|
93
|
+
# detail and examples
|
|
94
|
+
|
|
95
|
+
# format using "black" - use the console_scripts runner, against the "black" entrypoint
|
|
96
|
+
# hooks = black
|
|
97
|
+
# black.type = console_scripts
|
|
98
|
+
# black.entrypoint = black
|
|
99
|
+
# black.options = -l 79 REVISION_SCRIPT_FILENAME
|
|
100
|
+
|
|
101
|
+
# lint with attempts to fix using "ruff" - use the module runner, against the "ruff" module
|
|
102
|
+
# hooks = ruff
|
|
103
|
+
# ruff.type = module
|
|
104
|
+
# ruff.module = ruff
|
|
105
|
+
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
|
|
106
|
+
|
|
107
|
+
# Alternatively, use the exec runner to execute a binary found on your PATH
|
|
108
|
+
# hooks = ruff
|
|
109
|
+
# ruff.type = exec
|
|
110
|
+
# ruff.executable = ruff
|
|
111
|
+
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
|
|
112
|
+
|
|
113
|
+
# Logging configuration. This is also consumed by the user-maintained
|
|
114
|
+
# env.py script only.
|
|
115
|
+
[loggers]
|
|
116
|
+
keys = root,sqlalchemy,alembic
|
|
117
|
+
|
|
118
|
+
[handlers]
|
|
119
|
+
keys = console
|
|
120
|
+
|
|
121
|
+
[formatters]
|
|
122
|
+
keys = generic
|
|
123
|
+
|
|
124
|
+
[logger_root]
|
|
125
|
+
level = WARNING
|
|
126
|
+
handlers = console
|
|
127
|
+
qualname =
|
|
128
|
+
|
|
129
|
+
[logger_sqlalchemy]
|
|
130
|
+
level = WARNING
|
|
131
|
+
handlers =
|
|
132
|
+
qualname = sqlalchemy.engine
|
|
133
|
+
|
|
134
|
+
[logger_alembic]
|
|
135
|
+
level = INFO
|
|
136
|
+
handlers =
|
|
137
|
+
qualname = alembic
|
|
138
|
+
|
|
139
|
+
[handler_console]
|
|
140
|
+
class = StreamHandler
|
|
141
|
+
args = (sys.stderr,)
|
|
142
|
+
level = NOTSET
|
|
143
|
+
formatter = generic
|
|
144
|
+
|
|
145
|
+
[formatter_generic]
|
|
146
|
+
format = %(levelname)-5.5s [%(name)s] %(message)s
|
|
147
|
+
datefmt = %H:%M:%S
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Generic single-database configuration with an async dbapi.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from logging.config import fileConfig
|
|
3
|
+
|
|
4
|
+
from sqlalchemy import pool, text
|
|
5
|
+
from sqlalchemy.engine import Connection
|
|
6
|
+
from sqlalchemy.ext.asyncio import async_engine_from_config
|
|
7
|
+
|
|
8
|
+
from alembic import context
|
|
9
|
+
from core_framework.core import settings
|
|
10
|
+
|
|
11
|
+
# this is the Alembic Config object, which provides
|
|
12
|
+
# access to the values within the .ini file in use.
|
|
13
|
+
config = context.config
|
|
14
|
+
|
|
15
|
+
# Interpret the config file for Python logging.
|
|
16
|
+
# This line sets up loggers basically.
|
|
17
|
+
if config.config_file_name is not None:
|
|
18
|
+
fileConfig(config.config_file_name)
|
|
19
|
+
|
|
20
|
+
# add your model's MetaData object here
|
|
21
|
+
# for 'autogenerate' support
|
|
22
|
+
# from myapp import mymodel
|
|
23
|
+
# target_metadata = mymodel.Base.metadata
|
|
24
|
+
target_metadata = None
|
|
25
|
+
|
|
26
|
+
# other values from the config, defined by the needs of env.py,
|
|
27
|
+
# can be acquired:
|
|
28
|
+
# my_important_option = config.get_main_option("my_important_option")
|
|
29
|
+
# ... etc.
|
|
30
|
+
|
|
31
|
+
config.set_main_option("sqlalchemy.url", settings.write_postgres.alembic_postgres_url)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def run_migrations_offline() -> None:
|
|
35
|
+
"""Run migrations in 'offline' mode.
|
|
36
|
+
|
|
37
|
+
This configures the context with just a URL
|
|
38
|
+
and not an Engine, though an Engine is acceptable
|
|
39
|
+
here as well. By skipping the Engine creation
|
|
40
|
+
we don't even need a DBAPI to be available.
|
|
41
|
+
|
|
42
|
+
Calls to context.execute() here emit the given string to the
|
|
43
|
+
script output.
|
|
44
|
+
|
|
45
|
+
"""
|
|
46
|
+
url = config.get_main_option("sqlalchemy.url")
|
|
47
|
+
context.configure(
|
|
48
|
+
url=url,
|
|
49
|
+
target_metadata=target_metadata,
|
|
50
|
+
literal_binds=True,
|
|
51
|
+
dialect_opts={"paramstyle": "named"},
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
with context.begin_transaction():
|
|
55
|
+
context.run_migrations()
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def do_run_migrations(connection: Connection) -> None:
|
|
59
|
+
quoted_schema_name = f'"{settings.postgres_schemas.schema_moderation.replace('"', '""')}"'
|
|
60
|
+
|
|
61
|
+
connection.execute(text(f"create schema if not exists {quoted_schema_name}"))
|
|
62
|
+
connection.execute(text(f"set search_path to {quoted_schema_name}"))
|
|
63
|
+
connection.commit()
|
|
64
|
+
|
|
65
|
+
context.configure(connection=connection, target_metadata=target_metadata)
|
|
66
|
+
|
|
67
|
+
with context.begin_transaction():
|
|
68
|
+
context.run_migrations()
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
async def run_async_migrations() -> None:
|
|
72
|
+
"""In this scenario we need to create an Engine
|
|
73
|
+
and associate a connection with the context.
|
|
74
|
+
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
connectable = async_engine_from_config(
|
|
78
|
+
config.get_section(config.config_ini_section, {}),
|
|
79
|
+
prefix="sqlalchemy.",
|
|
80
|
+
poolclass=pool.NullPool,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
async with connectable.connect() as connection:
|
|
84
|
+
await connection.run_sync(do_run_migrations)
|
|
85
|
+
|
|
86
|
+
await connectable.dispose()
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def run_migrations_online() -> None:
|
|
90
|
+
"""Run migrations in 'online' mode."""
|
|
91
|
+
|
|
92
|
+
asyncio.run(run_async_migrations())
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
if context.is_offline_mode():
|
|
96
|
+
run_migrations_offline()
|
|
97
|
+
else:
|
|
98
|
+
run_migrations_online()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""${message}
|
|
2
|
+
|
|
3
|
+
Revision ID: ${up_revision}
|
|
4
|
+
Revises: ${down_revision | comma,n}
|
|
5
|
+
Create Date: ${create_date}
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
|
|
10
|
+
from alembic import op
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
${imports if imports else ""}
|
|
13
|
+
|
|
14
|
+
# revision identifiers, used by Alembic.
|
|
15
|
+
revision: str = ${repr(up_revision)}
|
|
16
|
+
down_revision: Union[str, Sequence[str], None] = ${repr(down_revision)}
|
|
17
|
+
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
|
|
18
|
+
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def upgrade() -> None:
|
|
22
|
+
"""Upgrade schema."""
|
|
23
|
+
${upgrades if upgrades else "pass"}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def downgrade() -> None:
|
|
27
|
+
"""Downgrade schema."""
|
|
28
|
+
${downgrades if downgrades else "pass"}
|
core_framework/alembic/moderation/alembic/versions/085ba9021850_add_category_to_user_restrictions.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""add category to user_restrictions
|
|
2
|
+
|
|
3
|
+
Revision ID: 085ba9021850
|
|
4
|
+
Revises: e66226952ea6
|
|
5
|
+
Create Date: 2026-02-07 07:39:55.810338
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from collections.abc import Sequence
|
|
10
|
+
|
|
11
|
+
from alembic import op
|
|
12
|
+
|
|
13
|
+
# revision identifiers, used by Alembic.
|
|
14
|
+
revision: str = "085ba9021850"
|
|
15
|
+
down_revision: str | Sequence[str] | None = "e66226952ea6"
|
|
16
|
+
branch_labels: str | Sequence[str] | None = None
|
|
17
|
+
depends_on: str | Sequence[str] | None = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade() -> None:
|
|
21
|
+
op.execute("""
|
|
22
|
+
create type restriction_category as enum (
|
|
23
|
+
'spam',
|
|
24
|
+
'harassment',
|
|
25
|
+
'inappropriate_content',
|
|
26
|
+
'impersonation',
|
|
27
|
+
'harmful_content',
|
|
28
|
+
'scam',
|
|
29
|
+
'other'
|
|
30
|
+
);
|
|
31
|
+
""")
|
|
32
|
+
op.execute("""
|
|
33
|
+
alter table user_restrictions
|
|
34
|
+
add column category restriction_category not null default 'other';
|
|
35
|
+
""")
|
|
36
|
+
op.execute("""
|
|
37
|
+
alter table restriction_history
|
|
38
|
+
add column category restriction_category;
|
|
39
|
+
""")
|
|
40
|
+
op.execute("""
|
|
41
|
+
create or replace function log_restriction_change()
|
|
42
|
+
returns trigger as $$
|
|
43
|
+
begin
|
|
44
|
+
if tg_op = 'INSERT' then
|
|
45
|
+
insert into moderation.restriction_history
|
|
46
|
+
(user_id, action, restriction_type, category, reason, expires_at, actor_id)
|
|
47
|
+
values
|
|
48
|
+
(new.user_id, 'inserted', new.restriction_type, new.category, new.reason, new.expires_at, current_setting('app.actor_id', true));
|
|
49
|
+
return new;
|
|
50
|
+
elsif tg_op = 'UPDATE' then
|
|
51
|
+
insert into moderation.restriction_history
|
|
52
|
+
(user_id, action, restriction_type, category, reason, expires_at, actor_id)
|
|
53
|
+
values
|
|
54
|
+
(new.user_id, 'updated', new.restriction_type, new.category, new.reason, new.expires_at, current_setting('app.actor_id', true));
|
|
55
|
+
return new;
|
|
56
|
+
elsif tg_op = 'DELETE' then
|
|
57
|
+
insert into moderation.restriction_history
|
|
58
|
+
(user_id, action, restriction_type, category, reason, expires_at, actor_id)
|
|
59
|
+
values
|
|
60
|
+
(old.user_id, 'deleted', old.restriction_type, old.category, old.reason, old.expires_at, current_setting('app.actor_id', true));
|
|
61
|
+
return old;
|
|
62
|
+
end if;
|
|
63
|
+
return null;
|
|
64
|
+
end;
|
|
65
|
+
$$ language plpgsql;
|
|
66
|
+
""")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def downgrade() -> None:
|
|
70
|
+
op.execute("""
|
|
71
|
+
create or replace function log_restriction_change()
|
|
72
|
+
returns trigger as $$
|
|
73
|
+
begin
|
|
74
|
+
if tg_op = 'INSERT' then
|
|
75
|
+
insert into moderation.restriction_history (user_id, action, restriction_type, reason, expires_at, actor_id)
|
|
76
|
+
values (new.user_id, 'inserted', new.restriction_type, new.reason, new.expires_at, current_setting('app.actor_id', true));
|
|
77
|
+
return new;
|
|
78
|
+
elsif tg_op = 'UPDATE' then
|
|
79
|
+
insert into moderation.restriction_history (user_id, action, restriction_type, reason, expires_at, actor_id)
|
|
80
|
+
values (new.user_id, 'updated', new.restriction_type, new.reason, new.expires_at, current_setting('app.actor_id', true));
|
|
81
|
+
return new;
|
|
82
|
+
elsif tg_op = 'DELETE' then
|
|
83
|
+
insert into moderation.restriction_history (user_id, action, restriction_type, reason, expires_at, actor_id)
|
|
84
|
+
values (old.user_id, 'deleted', old.restriction_type, old.reason, old.expires_at, current_setting('app.actor_id', true));
|
|
85
|
+
return old;
|
|
86
|
+
end if;
|
|
87
|
+
return null;
|
|
88
|
+
end;
|
|
89
|
+
$$ language plpgsql;
|
|
90
|
+
""")
|
|
91
|
+
op.execute("alter table restriction_history drop column if exists category;")
|
|
92
|
+
op.execute("alter table user_restrictions drop column if exists category;")
|
|
93
|
+
op.execute("drop type if exists restriction_category;")
|
core_framework/alembic/moderation/alembic/versions/5f9e4fc14a41_create_moderation_appeals_table.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""create moderation_appeals table
|
|
2
|
+
|
|
3
|
+
Revision ID: 5f9e4fc14a41
|
|
4
|
+
Revises: 63e37381e73b
|
|
5
|
+
Create Date: 2026-01-26 06:24:57.347829
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from collections.abc import Sequence
|
|
10
|
+
|
|
11
|
+
from alembic import op
|
|
12
|
+
|
|
13
|
+
# revision identifiers, used by Alembic.
|
|
14
|
+
revision: str = "5f9e4fc14a41"
|
|
15
|
+
down_revision: str | Sequence[str] | None = "63e37381e73b"
|
|
16
|
+
branch_labels: str | Sequence[str] | None = None
|
|
17
|
+
depends_on: str | Sequence[str] | None = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade() -> None:
|
|
21
|
+
op.execute("""
|
|
22
|
+
create type appeal_status as enum ('pending', 'approved', 'denied');
|
|
23
|
+
""")
|
|
24
|
+
op.execute("""
|
|
25
|
+
create table appeals (
|
|
26
|
+
id bigint generated always as identity primary key,
|
|
27
|
+
user_id varchar(128) not null,
|
|
28
|
+
justification text not null,
|
|
29
|
+
decision_reason text,
|
|
30
|
+
reviewer_id varchar(128),
|
|
31
|
+
status appeal_status not null default 'pending',
|
|
32
|
+
created_at timestamptz not null default now(),
|
|
33
|
+
updated_at timestamptz not null default now()
|
|
34
|
+
);
|
|
35
|
+
""")
|
|
36
|
+
op.execute("""
|
|
37
|
+
create or replace function prevent_appeal_mutation_if_decided()
|
|
38
|
+
returns trigger as $$
|
|
39
|
+
begin
|
|
40
|
+
if old.status != 'pending' then
|
|
41
|
+
raise exception 'Appeal row is read-only once a decision has been made (status: %)', old.status;
|
|
42
|
+
end if;
|
|
43
|
+
if tg_op = 'DELETE' then
|
|
44
|
+
return old;
|
|
45
|
+
end if;
|
|
46
|
+
return new;
|
|
47
|
+
end;
|
|
48
|
+
$$ language plpgsql;
|
|
49
|
+
""")
|
|
50
|
+
op.execute("""
|
|
51
|
+
create trigger prevent_appeal_update_if_decided
|
|
52
|
+
before update on appeals
|
|
53
|
+
for each row
|
|
54
|
+
execute function prevent_appeal_mutation_if_decided();
|
|
55
|
+
""")
|
|
56
|
+
op.execute("""
|
|
57
|
+
create trigger prevent_appeal_delete_if_decided
|
|
58
|
+
before delete on appeals
|
|
59
|
+
for each row
|
|
60
|
+
execute function prevent_appeal_mutation_if_decided();
|
|
61
|
+
""")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def downgrade() -> None:
|
|
65
|
+
op.execute("drop trigger if exists prevent_appeal_update_if_decided on appeals;")
|
|
66
|
+
op.execute("drop trigger if exists prevent_appeal_delete_if_decided on appeals;")
|
|
67
|
+
op.execute("drop function if exists prevent_appeal_mutation_if_decided();")
|
|
68
|
+
op.execute("drop table if exists appeals;")
|
|
69
|
+
op.execute("drop type if exists appeal_status;")
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""add user_reports table
|
|
2
|
+
|
|
3
|
+
Revision ID: 63e37381e73b
|
|
4
|
+
Revises: a5e569f5df1a
|
|
5
|
+
Create Date: 2026-01-23 06:03:09.660998
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from collections.abc import Sequence
|
|
10
|
+
|
|
11
|
+
from alembic import op
|
|
12
|
+
|
|
13
|
+
# revision identifiers, used by Alembic.
|
|
14
|
+
revision: str = "63e37381e73b"
|
|
15
|
+
down_revision: str | Sequence[str] | None = "a5e569f5df1a"
|
|
16
|
+
branch_labels: str | Sequence[str] | None = None
|
|
17
|
+
depends_on: str | Sequence[str] | None = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade() -> None:
|
|
21
|
+
op.execute("""
|
|
22
|
+
create table user_reports (
|
|
23
|
+
id bigint generated always as identity primary key,
|
|
24
|
+
reporter_id varchar(128) not null,
|
|
25
|
+
target_id varchar(128) not null,
|
|
26
|
+
reason text not null,
|
|
27
|
+
created_at timestamptz not null default now()
|
|
28
|
+
)
|
|
29
|
+
""")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def downgrade() -> None:
|
|
33
|
+
op.execute("drop table if exists user_reports")
|
core_framework/alembic/moderation/alembic/versions/6a2ae31b7ac6_add_moderation_actions_table.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""add moderation_actions table
|
|
2
|
+
|
|
3
|
+
Revision ID: 6a2ae31b7ac6
|
|
4
|
+
Revises: d4af74643ff5
|
|
5
|
+
Create Date: 2026-02-15 06:29:45.952315
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from collections.abc import Sequence
|
|
10
|
+
|
|
11
|
+
from alembic import op
|
|
12
|
+
|
|
13
|
+
# revision identifiers, used by Alembic.
|
|
14
|
+
revision: str = "6a2ae31b7ac6"
|
|
15
|
+
down_revision: str | Sequence[str] | None = "d4af74643ff5"
|
|
16
|
+
branch_labels: str | Sequence[str] | None = None
|
|
17
|
+
depends_on: str | Sequence[str] | None = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade() -> None:
|
|
21
|
+
op.execute("""
|
|
22
|
+
create table moderation_actions (
|
|
23
|
+
id bigint generated always as identity primary key,
|
|
24
|
+
actor_id varchar(128) not null,
|
|
25
|
+
action_type varchar(64) not null,
|
|
26
|
+
target_user_id varchar(128),
|
|
27
|
+
action_metadata jsonb not null default '{}'::jsonb,
|
|
28
|
+
created_at timestamptz not null default now()
|
|
29
|
+
)
|
|
30
|
+
""")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def downgrade() -> None:
|
|
34
|
+
op.execute("drop table if exists moderation_actions")
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""improve indexes
|
|
2
|
+
|
|
3
|
+
Revision ID: 716aa1735c03
|
|
4
|
+
Revises: 95cc35a51984
|
|
5
|
+
Create Date: 2026-02-08 12:05:14.638700
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from collections.abc import Sequence
|
|
10
|
+
|
|
11
|
+
from alembic import op
|
|
12
|
+
|
|
13
|
+
# revision identifiers, used by Alembic.
|
|
14
|
+
revision: str = "716aa1735c03"
|
|
15
|
+
down_revision: str | Sequence[str] | None = "95cc35a51984"
|
|
16
|
+
branch_labels: str | Sequence[str] | None = None
|
|
17
|
+
depends_on: str | Sequence[str] | None = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade() -> None:
|
|
21
|
+
op.execute("""
|
|
22
|
+
create index idx_user_restrictions_expired_mutes
|
|
23
|
+
on user_restrictions (restriction_type, expires_at)
|
|
24
|
+
where expires_at is not null
|
|
25
|
+
""")
|
|
26
|
+
|
|
27
|
+
op.execute("drop index if exists idx_restriction_history_user_id")
|
|
28
|
+
op.execute("""
|
|
29
|
+
create index idx_restriction_history_user_created
|
|
30
|
+
on restriction_history (user_id, created_at desc)
|
|
31
|
+
""")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def downgrade() -> None:
|
|
35
|
+
op.execute("drop index if exists idx_user_restrictions_expired_mutes")
|
|
36
|
+
op.execute("drop index if exists idx_restriction_history_user_created")
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""add post_reports table
|
|
2
|
+
|
|
3
|
+
Revision ID: 7d243ddbfde1
|
|
4
|
+
Revises: 6a2ae31b7ac6
|
|
5
|
+
Create Date: 2026-03-04 06:33:46.200196
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from collections.abc import Sequence
|
|
10
|
+
|
|
11
|
+
from alembic import op
|
|
12
|
+
|
|
13
|
+
# revision identifiers, used by Alembic.
|
|
14
|
+
revision: str = "7d243ddbfde1"
|
|
15
|
+
down_revision: str | Sequence[str] | None = "6a2ae31b7ac6"
|
|
16
|
+
branch_labels: str | Sequence[str] | None = None
|
|
17
|
+
depends_on: str | Sequence[str] | None = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade() -> None:
|
|
21
|
+
op.execute("""
|
|
22
|
+
create table post_reports (
|
|
23
|
+
id bigint generated always as identity primary key,
|
|
24
|
+
reporter_id varchar(128) not null,
|
|
25
|
+
target_id varchar(26) not null,
|
|
26
|
+
category report_category not null default 'other',
|
|
27
|
+
reason text not null default '',
|
|
28
|
+
created_at timestamptz not null default now(),
|
|
29
|
+
constraint post_reports_reporter_target_unique unique (reporter_id, target_id)
|
|
30
|
+
)
|
|
31
|
+
""")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def downgrade() -> None:
|
|
35
|
+
op.execute("drop table if exists post_reports")
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""add indexes
|
|
2
|
+
|
|
3
|
+
Revision ID: 8fba1f72dd46
|
|
4
|
+
Revises: f5e8cb275c30
|
|
5
|
+
Create Date: 2026-02-04 12:41:23.204366
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from collections.abc import Sequence
|
|
10
|
+
|
|
11
|
+
from alembic import op
|
|
12
|
+
|
|
13
|
+
revision: str = "8fba1f72dd46"
|
|
14
|
+
down_revision: str | Sequence[str] | None = "f5e8cb275c30"
|
|
15
|
+
branch_labels: str | Sequence[str] | None = None
|
|
16
|
+
depends_on: str | Sequence[str] | None = None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def upgrade() -> None:
|
|
20
|
+
op.execute("""
|
|
21
|
+
create index idx_user_reports_created_at
|
|
22
|
+
on user_reports (created_at desc)
|
|
23
|
+
include (id, reporter_id, target_id, reason)
|
|
24
|
+
""")
|
|
25
|
+
|
|
26
|
+
op.execute("""
|
|
27
|
+
create index idx_user_reports_cooldown
|
|
28
|
+
on user_reports (reporter_id, target_id, created_at desc)
|
|
29
|
+
""")
|
|
30
|
+
|
|
31
|
+
op.execute("""
|
|
32
|
+
create index idx_appeals_updated_at
|
|
33
|
+
on appeals (updated_at desc)
|
|
34
|
+
""")
|
|
35
|
+
|
|
36
|
+
op.execute("""
|
|
37
|
+
create index idx_user_reports_reporter_id
|
|
38
|
+
on user_reports (reporter_id)
|
|
39
|
+
""")
|
|
40
|
+
|
|
41
|
+
op.execute("""
|
|
42
|
+
create index idx_user_reports_target_id
|
|
43
|
+
on user_reports (target_id)
|
|
44
|
+
""")
|
|
45
|
+
|
|
46
|
+
op.execute("""
|
|
47
|
+
create index idx_restriction_history_user_id
|
|
48
|
+
on restriction_history (user_id)
|
|
49
|
+
""")
|
|
50
|
+
|
|
51
|
+
op.execute("""
|
|
52
|
+
create index idx_appeals_user_id
|
|
53
|
+
on appeals (user_id)
|
|
54
|
+
""")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def downgrade() -> None:
|
|
58
|
+
op.execute("drop index if exists idx_user_reports_created_at")
|
|
59
|
+
op.execute("drop index if exists idx_user_reports_cooldown")
|
|
60
|
+
op.execute("drop index if exists idx_appeals_updated_at")
|
|
61
|
+
op.execute("drop index if exists idx_user_reports_reporter_id")
|
|
62
|
+
op.execute("drop index if exists idx_user_reports_target_id")
|
|
63
|
+
op.execute("drop index if exists idx_restriction_history_user_id")
|
|
64
|
+
op.execute("drop index if exists idx_appeals_user_id")
|