webstatus.dev
webstatus.dev copied to clipboard
[BUG] Add missing ON DELETE CASCADE constraints on some tables
Describe the bug When in Spanner Studio for the GCP dashboard, I expect to be able to quickly delete a feature row by selecting the row and hitting the delete button. But that is not possible.
To Reproduce Steps to reproduce the behavior:
- Go to the data section in GCP
- Find the row I want to delete
- Select the checkbox and hit delete at the top
- I get this error:
Foreign key constraint violation when deleting or updating referenced row(s): referencing row(s) found in table "BrowserFeatureAvailabilities".
- As a result, I have to manually delete things in reverse order with this kind of script in Spanner Studio:
-- Delete from WPTRunFeatureMetrics
DELETE FROM WPTRunFeatureMetrics WHERE WebFeatureID = 'IDHERE';
-- Delete from BrowserFeatureAvailabilities
DELETE FROM BrowserFeatureAvailabilities WHERE WebFeatureID = 'IDHERE';
-- Delete from FeatureBaselineStatus
DELETE FROM FeatureBaselineStatus WHERE WebFeatureID = 'IDHERE';
-- Delete from FeatureSpecs
DELETE FROM FeatureSpecs WHERE WebFeatureID = 'IDHERE';
-- Finally, delete the web feature itself
DELETE FROM WebFeatures WHERE ID = 'IDHERE';
Expected behavior
- Go to the data section in GCP
- Find the row I want to delete
- Select the checkbox and hit delete at the top
- Delete successful
Additional context This is meant for permanently deleting features. There is a workaround using the script above. But this would be a one button click if these tables had ON DELETE CASCADE.
For temporarily hiding, we can continue to use the ExcludeFeatures table. That should not be touched