mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-17 21:18:16 -06:00
12510 move migration
This commit is contained in:
parent
ed361611e4
commit
7fe0ee5104
@ -1,28 +0,0 @@
|
|||||||
# Generated by Django 5.0.1 on 2024-01-26 18:11
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
def migrate_report_jobs(apps, schema_editor):
|
|
||||||
ContentType = apps.get_model('contenttypes', 'ContentType')
|
|
||||||
Job = apps.get_model('core', 'Job')
|
|
||||||
|
|
||||||
# Delete the new ContentType effected by the introduction of core.ConfigRevision
|
|
||||||
if ContentType.objects.filter(app_label='extras', model='reportmodule'):
|
|
||||||
report_content_type = ContentType.objects.get(app_label='extras', model='reportmodule')
|
|
||||||
script_content_type = ContentType.objects.get(app_label='extras', model='scriptmodule')
|
|
||||||
jobs = Job.objects.filter(object_type_id=report_content_type.id).update(object_type_id=script_content_type.id)
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('core', '0010_gfk_indexes'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RunPython(
|
|
||||||
code=migrate_report_jobs,
|
|
||||||
reverse_code=migrations.RunPython.noop
|
|
||||||
),
|
|
||||||
]
|
|
@ -3,14 +3,28 @@
|
|||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def migrate_report_jobs(apps, schema_editor):
|
||||||
|
ContentType = apps.get_model('contenttypes', 'ContentType')
|
||||||
|
Job = apps.get_model('core', 'Job')
|
||||||
|
|
||||||
|
# Delete the new ContentType effected by the introduction of core.ConfigRevision
|
||||||
|
if ContentType.objects.filter(app_label='extras', model='reportmodule'):
|
||||||
|
report_content_type = ContentType.objects.get(app_label='extras', model='reportmodule')
|
||||||
|
script_content_type = ContentType.objects.get(app_label='extras', model='scriptmodule')
|
||||||
|
jobs = Job.objects.filter(object_type_id=report_content_type.id).update(object_type_id=script_content_type.id)
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('extras', '0105_customfield_min_max_values'),
|
('extras', '0105_customfield_min_max_values'),
|
||||||
('core', '0011_job_report_to_script'),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
migrations.RunPython(
|
||||||
|
code=migrate_report_jobs,
|
||||||
|
reverse_code=migrations.RunPython.noop
|
||||||
|
),
|
||||||
migrations.DeleteModel(
|
migrations.DeleteModel(
|
||||||
name='Report',
|
name='Report',
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user