37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
# Generated by Django 4.2.29 on 2026-05-23 21:24
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
def copy_birding_data(apps, schema_editor):
|
|
OldImport = apps.get_model("birds", "BirdingCSVImport")
|
|
NewImport = apps.get_model("scrobbles", "EBirdCSVImport")
|
|
db_alias = schema_editor.connection.alias
|
|
|
|
for old in OldImport.objects.using(db_alias).iterator():
|
|
NewImport.objects.using(db_alias).create(
|
|
id=old.id,
|
|
created=old.created,
|
|
modified=old.modified,
|
|
uuid=old.uuid,
|
|
user=old.user,
|
|
processing_started=old.processing_started,
|
|
processed_finished=old.processed_finished,
|
|
process_log=old.process_log,
|
|
process_count=old.process_count,
|
|
csv_file=old.csv_file,
|
|
original_filename=(
|
|
old.csv_file.name.rpartition("/")[-1] if old.csv_file else None
|
|
),
|
|
)
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("scrobbles", "0082_ebird_csv_import_model"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(copy_birding_data, migrations.RunPython.noop),
|
|
]
|