Skip to content

Commit

Permalink
Migrate private versions
Browse files Browse the repository at this point in the history
This only affects the community site.
  • Loading branch information
stsewd committed Jun 11, 2020
1 parent 7da84af commit eaf7321
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions readthedocs/builds/migrations/0025_migrate_private_versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 2.2.12 on 2020-06-11 01:14

from django.db import migrations
from django.conf import settings


def forwards_func(apps, schema_editor):
"""
Migrate all private versions to public and hidden.
.. note::
This migration is skipped for the corporate site.
"""
if settings.ALLOW_PRIVATE_REPOS:
return

Version = apps.get_model('builds', 'Version')
(
Version.objects
.filter(privacy_level='private')
.update(privacy_level='public', hidden=True)
)


class Migration(migrations.Migration):

dependencies = [
('builds', '0024_status_code_choices'),
]

operations = [
migrations.RunPython(forwards_func),
]

0 comments on commit eaf7321

Please sign in to comment.