Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed dataset_repo migration #3827

Merged
merged 2 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Incorrect work when copy job list with "Copy" button (<https://github.com/openvinotoolkit/cvat/pull/3749>)
- Iterating over manifest (<https://github.com/openvinotoolkit/cvat/pull/3792>)
- Manifest removing (<https://github.com/openvinotoolkit/cvat/pull/3791>)
- Migration of `dataset_repo` application (<https://github.com/openvinotoolkit/cvat/pull/3827>)

### Security

Expand Down
14 changes: 10 additions & 4 deletions cvat/apps/dataset_repo/migrations/0006_gitdata_format.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# Generated by Django 2.1.3 on 2019-02-05 17:08
# Generated by Django 3.1.13 on 2021-10-26 10:10

from django.db import migrations, models


def update_default_format_field(apps, schema_editor):
GitData = apps.get_model('dataset_repo', 'GitData')
for git_data in GitData.objects.all():
if not git_data.format:
git_data.format = 'CVAT for images 1.1' if git_data.task.mode == 'annotation' else 'CVAT for video 1.1'
git_data.save()
class Migration(migrations.Migration):

dependencies = [
('dataset_repo', '0005_auto_20201019_1100'),
]

replaces = [('git', '0006_gitdata_format')]

operations = [
migrations.AddField(
model_name='gitdata',
name='format',
field=models.CharField(max_length=256)
field=models.CharField(blank=True, max_length=256),
),
migrations.RunPython(update_default_format_field),
]
2 changes: 1 addition & 1 deletion cvat/apps/dataset_repo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GitData(models.Model):
task = models.OneToOneField(Task, on_delete = models.CASCADE, primary_key = True)
url = models.URLField(max_length = 2000)
path = models.CharField(max_length=256)
format = models.CharField(max_length=256)
format = models.CharField(max_length=256, blank=True)
sync_date = models.DateTimeField(auto_now_add=True)
status = models.CharField(max_length=20, default=GitStatusChoice.NON_SYNCED)
lfs = models.BooleanField(default=True)