Files
zulip/zerver/migrations/0554_imageattachment.py
Alex Vandiver 2e38f426f4 upload: Generate thumbnails when images are uploaded.
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.
2024-07-16 13:22:15 -07:00

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"
),
),
],
),
]