diff --git a/docs/operations/data_migration.md b/docs/operations/data_migration.md index 213e7f6ee..c4d2c150c 100644 --- a/docs/operations/data_migration.md +++ b/docs/operations/data_migration.md @@ -243,7 +243,7 @@ Run the following command, making sure the file paths point to the right locatio ##### LOCAL COMMAND ```shell -docker-compose exec app ./manage.py load_transition_domain migrationFilepaths.json --directory /app/tmp --debug +docker-compose exec app ./manage.py load_transition_domain migrationFilepaths.json --directory /app/tmp/ --debug --limitParse 10 ``` ##### SANDBOX COMMAND ```shell diff --git a/src/registrar/management/commands/load_transition_domain.py b/src/registrar/management/commands/load_transition_domain.py index df1974a18..a38a7366e 100644 --- a/src/registrar/management/commands/load_transition_domain.py +++ b/src/registrar/management/commands/load_transition_domain.py @@ -64,9 +64,14 @@ class Command(BaseCommand): ) parser.add_argument( - "--directory", default="migrationdata", help="Desired directory" + "--infer_filenames", + action=argparse.BooleanOptionalAction, + help="Determines if we should infer filenames or not. Recommended to be enabled only in a development or testing setting." ) + parser.add_argument( + "--directory", default="migrationdata", help="Desired directory" + ) parser.add_argument( "--domain_contacts_filename", help="Data file with domain contact information" @@ -79,11 +84,6 @@ class Command(BaseCommand): "--domain_statuses_filename", help="Data file with domain status information" ) - parser.add_argument( - "--infer_filenames", - action=argparse.BooleanOptionalAction, - help="Determines if we should infer filenames or not. Recommended to be enabled only in a development or testing setting." - ) parser.add_argument( "--agency_adhoc_filename", default=EnumFilenames.AGENCY_ADHOC.value[1], @@ -322,10 +322,19 @@ class Command(BaseCommand): ): """Parse the data files and create TransitionDomains.""" args = TransitionDomainArguments(**options) + + # Desired directory for additional TransitionDomain data + # (In the event they are stored seperately) + directory = args.directory + # Add a slash if the last character isn't one + if directory and directory[-1] != "/": + directory += "/" + + json_filepath = directory + migration_json_filename ### Process JSON file ### # If a JSON was provided, use its values instead of defaults. # TODO: there is no way to discern user overrides from those arg’s defaults. - with open(migration_json_filename, "r") as jsonFile: + with open(json_filepath, "r") as jsonFile: # load JSON object as a dictionary try: data = json.load(jsonFile) @@ -361,12 +370,6 @@ class Command(BaseCommand): ## Variables for Additional TransitionDomain Information ## - # Desired directory for additional TransitionDomain data - # (In the event they are stored seperately) - directory = args.directory - # Add a slash if the last character isn't one - if directory and directory[-1] != "/": - directory += "/" # Main script filenames - these do not have defaults domain_contacts_filename = None