mirror of
https://github.com/zulip/zulip.git
synced 2025-10-22 20:42:14 +00:00
This migration applies under the assumption that extra_data_json has been populated for all existing and coming audit log entries. - This removes the manual conversions back and forth for extra_data throughout the codebase including the orjson.loads(), orjson.dumps(), and str() calls. - The custom handler used for converting Decimal is removed since DjangoJSONEncoder handles that for extra_data. - We remove None-checks for extra_data because it is now no longer nullable. - Meanwhile, we want the bouncer to support processing RealmAuditLog entries for remote servers before and after the JSONField migration on extra_data. - Since now extra_data should always be a dict for the newer remote server, which is now migrated, the test cases are updated to create RealmAuditLog objects by passing a dict for extra_data before sending over the analytics data. Note that while JSONField allows for non-dict values, a proper remote server always passes a dict for extra_data. - We still test out the legacy extra_data format because not all remote servers have migrated to use JSONField extra_data. This verifies that support for extra_data being a string or None has not been dropped. Co-authored-by: Siddharth Asthana <siddharthasthana31@gmail.com> Signed-off-by: Zixuan James Li <p359101898@gmail.com>
31 lines
840 B
Python
31 lines
840 B
Python
# Generated by Django 4.0.7 on 2022-10-02 17:02
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("zilencer", "0027_backfill_remote_realmauditlog_extradata_to_json_field"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RemoveField(
|
|
model_name="remoterealmauditlog",
|
|
name="extra_data",
|
|
),
|
|
migrations.RemoveField(
|
|
model_name="remotezulipserverauditlog",
|
|
name="extra_data",
|
|
),
|
|
migrations.RenameField(
|
|
model_name="remoterealmauditlog",
|
|
old_name="extra_data_json",
|
|
new_name="extra_data",
|
|
),
|
|
migrations.RenameField(
|
|
model_name="remotezulipserverauditlog",
|
|
old_name="extra_data_json",
|
|
new_name="extra_data",
|
|
),
|
|
]
|