# Generated by Django 3.1.3 on 2020-12-02 09:04
from django.db import migrations
from djangoProject_test.settings import BASE_DIR


def load_raw_data(apps, schema_editor):
    """
    load initial set of data
    :return:
    """
    from season.import_raw_data import InitialDataProcessor
    matches_path = str(BASE_DIR) + '/season/migrations/matches.csv'
    deliveries_path = str(BASE_DIR) + '/season/migrations/deliveries.csv'
    # Initialization path to read data
    load_data = InitialDataProcessor(matches_path=matches_path, deliveries_path=deliveries_path)
    # transform data frame and save the data step by step
    # only support new season import for the first tym when data structure is ready to use
    load_data.transform_input_save()


class Migration(migrations.Migration):

    dependencies = [
        ('season', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(load_raw_data),
    ]
