mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
attachment: Make path_id field unique.
This will help avoid future bugs similar to that fixed in migration 0072.
This commit is contained in:
25
zerver/migrations/0075_attachment_path_id_unique.py
Normal file
25
zerver/migrations/0075_attachment_path_id_unique.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.5 on 2017-04-13 22:29
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('zerver', '0074_fix_duplicate_attachments'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='archivedattachment',
|
||||||
|
name='path_id',
|
||||||
|
field=models.TextField(db_index=True, unique=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='attachment',
|
||||||
|
name='path_id',
|
||||||
|
field=models.TextField(db_index=True, unique=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -1226,7 +1226,7 @@ class AbstractAttachment(ModelReprMixin, models.Model):
|
|||||||
# path_id is a storage location agnostic representation of the path of the file.
|
# path_id is a storage location agnostic representation of the path of the file.
|
||||||
# If the path of a file is http://localhost:9991/user_uploads/a/b/abc/temp_file.py
|
# If the path of a file is http://localhost:9991/user_uploads/a/b/abc/temp_file.py
|
||||||
# then its path_id will be a/b/abc/temp_file.py.
|
# then its path_id will be a/b/abc/temp_file.py.
|
||||||
path_id = models.TextField(db_index=True) # type: Text
|
path_id = models.TextField(db_index=True, unique=True) # type: Text
|
||||||
owner = models.ForeignKey(UserProfile) # type: UserProfile
|
owner = models.ForeignKey(UserProfile) # type: UserProfile
|
||||||
realm = models.ForeignKey(Realm, blank=True, null=True) # type: Realm
|
realm = models.ForeignKey(Realm, blank=True, null=True) # type: Realm
|
||||||
is_realm_public = models.BooleanField(default=False) # type: bool
|
is_realm_public = models.BooleanField(default=False) # type: bool
|
||||||
|
|||||||
Reference in New Issue
Block a user