mirror of
https://github.com/zulip/zulip.git
synced 2025-10-26 17:43:58 +00:00
A new table is created to track which path_id attachments are images, and for those their metadata, and which thumbnails have been created. Using path_id as the effective primary key lets us ignore if the attachment is archived or not, saving some foreign key messes. A new worker is added to observe events when rows are added to this table, and to generate and store thumbnails for those images in differing sizes and formats.
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
import django.db.models.deletion
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("zerver", "0553_copy_emoji_images"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="ImageAttachment",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
|
),
|
|
),
|
|
("path_id", models.TextField(db_index=True, unique=True)),
|
|
("original_width_px", models.IntegerField()),
|
|
("original_height_px", models.IntegerField()),
|
|
("frames", models.IntegerField()),
|
|
("thumbnail_metadata", models.JSONField(default=list)),
|
|
(
|
|
"realm",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.realm"
|
|
),
|
|
),
|
|
],
|
|
),
|
|
]
|