GitHub user dosubot[bot] added a comment to the discussion: How to allow the deletion of users with associated objects
<!-- Answer --> Yes, the configuration parameter that allows the deletion of a user along with the data in their associated tables is the `on_delete="CASCADE"` option in the foreign key definitions. This parameter is used in the `upgrade()` function to redefine foreign keys with the `on_delete="CASCADE"` behavior, which automatically deletes associated objects when a user is deleted. For example, in Apache Superset, the `upgrade()` function in a migration script can redefine foreign keys with `on_delete="CASCADE"` to ensure that related entries in tables like `dashboard_roles` are automatically removed when the corresponding entries in the `dashboards` or `ab_role` tables are deleted <sup>[[1]](https://github.com/apache/superset/blob/master/superset/migrations/versions/2023-07-11_15-51_6d05b0a70c89_add_on_delete_cascade_for_owners_references.py)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset/migrations/versions/2023-09-15_12-58_4b85906e5b91_add_on_delete_cascade_for_dashboar d_roles.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/db83e388-b57f-47b1-b27b-40b346d6e579?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/db83e388-b57f-47b1-b27b-40b346d6e579?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/db83e388-b57f-47b1-b27b-40b346d6e579?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/db83e388-b57f-47b1-b27b-40b346d6e579?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/db83e388-b57f-47b1-b27b-40b346d6e579?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/db83e388-b57f-47b1-b27b-40b346d6e579?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/db83e388-b57f-47b1-b27b-40b346d6e579?feedback_type=other)</sup> GitHub link: https://github.com/apache/superset/discussions/32807#discussioncomment-12590977 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
