Skip to content

Commit 8a3e5b6

Browse files
jerabekjiripatchback[bot]
authored andcommitted
Set retain_repo_versions: 1 to validated repository (#2461)
* set retain_repo_versions: 1 to validated repo (cherry picked from commit 1d97bc4)
1 parent 95e23e0 commit 8a3e5b6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from django.db import migrations
2+
3+
4+
def set_retain_repo_versions_to_validated_repo(apps, schema_editor):
5+
AnsibleRepository = apps.get_model('ansible', 'AnsibleRepository')
6+
7+
db_alias = schema_editor.connection.alias
8+
9+
validated_repo = AnsibleRepository.objects.using(db_alias).filter(name="validated").first()
10+
if validated_repo and validated_repo.retain_repo_versions is None:
11+
validated_repo.retain_repo_versions = 1
12+
validated_repo.save()
13+
14+
15+
class Migration(migrations.Migration):
16+
17+
dependencies = [
18+
("galaxy", "0055_remove_organization_users_remove_team_users"),
19+
]
20+
21+
operations = [
22+
migrations.RunPython(
23+
code=set_retain_repo_versions_to_validated_repo,
24+
reverse_code=migrations.RunPython.noop
25+
),
26+
]

0 commit comments

Comments
 (0)