Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: truncate dev data command now keeps config data intact #2805

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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."))