From 6ea2bb54e4f446d1efdd5ac7242efcd402026319 Mon Sep 17 00:00:00 2001 From: Pierre Bastianelli Date: Thu, 6 Feb 2025 15:25:22 -0800 Subject: [PATCH] chore: truncate dev data command now keeps config data intact --- .../commands/truncate_dev_data_tables.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bc_obps/common/management/commands/truncate_dev_data_tables.py b/bc_obps/common/management/commands/truncate_dev_data_tables.py index 75fb981a59..1dca136608 100644 --- a/bc_obps/common/management/commands/truncate_dev_data_tables.py +++ b/bc_obps/common/management/commands/truncate_dev_data_tables.py @@ -14,6 +14,21 @@ def handle(self, *args, **options): "activity", "reporting_year", "user", # This table has some seeded data (for e2e tests) that should not be truncated + # reporting program configuration tables + "configuration", + "configuration_element", + "activity_json_schema", + "activity_source_type_json_schema", + "custom_methodology_schema", + "emission_category", + "emission_category_mapping", + "fuel_type", + "gas_type", + "methodology", + "naics_regulatory_values", + "product_emission_intensity", + "reporting_field", + "source_type", ] schemas = ["erc", "erc_history"] for schema in schemas: @@ -26,4 +41,4 @@ def handle(self, *args, **options): full_truncate_statement = truncate_statement % table_name cursor.execute(full_truncate_statement) - self.stdout.write(self.style.SUCCESS('All tables have been truncated.')) + self.stdout.write(self.style.SUCCESS("All tables have been truncated."))