Skip to content

Commit

Permalink
Merge pull request #2805 from bcgov/fix/truncating-dev-data-wipes-pro…
Browse files Browse the repository at this point in the history
…gram-config-data

Fix: truncate dev data command now keeps config data intact
  • Loading branch information
pbastia authored Feb 7, 2025
2 parents 338ff6f + 6ea2bb5 commit 6685569
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion bc_obps/common/management/commands/truncate_dev_data_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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."))

0 comments on commit 6685569

Please sign in to comment.