webstatus.dev icon indicating copy to clipboard operation
webstatus.dev copied to clipboard

[BUG] Add missing ON DELETE CASCADE constraints on some tables

Open jcscottiii opened this issue 7 months ago • 0 comments

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:

  1. Go to the data section in GCP
  2. Find the row I want to delete
  3. Select the checkbox and hit delete at the top
  4. I get this error: Foreign key constraint violation when deleting or updating referenced row(s): referencing row(s) found in table "BrowserFeatureAvailabilities".
  5. 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

  1. Go to the data section in GCP
  2. Find the row I want to delete
  3. Select the checkbox and hit delete at the top
  4. 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

jcscottiii avatar Jul 17 '24 13:07 jcscottiii