Remove emergency alerts data#4516
Merged
Merged
Conversation
This is a data migration (so no downgrade) that deletes broadcast services and all associated data - this includes obvious things like broadcast events and templates, but also everything connected to those services. Although some of these theoretically shouldn't exist for broadcast services (eg returned_letters), we attempt to delete them out of an abundance of caution. This work is based off an older PR, which was tested against a copy of the staging database. That PR was reverted because it was taking too long to delete from the `notification_history` table due to the foreign key constraints - since then, indexes have been added to notification_history to make deleting from the table faster. Differences between this PR and the original are: * the `service_inbound_api` table no longer exists, so has been removed from the migration * this adds the `api_keys_history`, `service_callback_api_history`, `ft_billing` and `ft_notification_status` tables to the list we delete from * this deletes from the `notifications` and `notification_history` tables first - these have various foreign key constraints on other tables which would cause issues if the data from those other tables is deleted first.
Contributor
Author
|
Squawk is giving this error ...
res = results.fetchall()
^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'fetchall' I have tested this locally and confirmed that |
joybytes
approved these changes
Jul 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a data migration (so no downgrade) that deletes broadcast services and all associated data - this includes obvious things like broadcast events and templates, but also everything connected to those services.
Although some of these theoretically shouldn't exist for broadcast services (eg returned_letters), we attempt to delete them out of an abundance of caution.
This work is based off an older PR, which was tested against a copy of the staging database. That PR was reverted because it was taking too long to delete from the
notification_historytable due to the foreign key constraints - since then, indexes have been added to notification_history to make deleting from the table faster.Differences between this PR and the original are:
service_inbound_apitable no longer exists, so has been removed from the migrationapi_keys_history,service_callback_api_history,ft_billingandft_notification_statustables to the list we delete fromnotificationsandnotification_historytables first - these have various foreign key constraints on other tables which would cause issues if the data from those other tables is deleted first.