mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 00:38:45 -03:30
Remove hg updates and projects in migration
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
# Generated by Django 2.2.16 on 2020-12-01 18:50
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
from awx.main.migrations._hg_removal import delete_hg_scm
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
@@ -10,6 +9,7 @@ class Migration(migrations.Migration):
|
|||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
migrations.RunPython(delete_hg_scm),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='project',
|
model_name='project',
|
||||||
name='scm_type',
|
name='scm_type',
|
||||||
|
|||||||
12
awx/main/migrations/_hg_removal.py
Normal file
12
awx/main/migrations/_hg_removal.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger('awx.main.migrations')
|
||||||
|
|
||||||
|
|
||||||
|
def delete_hg_scm(apps, schema_editor):
|
||||||
|
set_current_apps(apps)
|
||||||
|
Project = apps.get_model('main', 'Project')
|
||||||
|
ProjectUpdate = apps.get_model('main', 'ProjectUpdate')
|
||||||
|
|
||||||
|
ProjectUpdate.objects.filter(project__scm_type='hg').delete()
|
||||||
|
Project.objects.filter(scm_type='hg').delete()
|
||||||
Reference in New Issue
Block a user