mirror of
https://gitee.com/dify_ai/dify.git
synced 2024-12-02 19:27:48 +08:00
fix: add event handler to delete the site when the related app deleted (#5282)
This commit is contained in:
parent
4f60fe7bc6
commit
42029791e4
@ -5,6 +5,7 @@ from .create_installed_app_when_app_created import handle
|
||||
from .create_site_record_when_app_created import handle
|
||||
from .deduct_quota_when_messaeg_created import handle
|
||||
from .delete_installed_app_when_app_deleted import handle
|
||||
from .delete_site_record_when_app_deleted import handle
|
||||
from .delete_tool_parameters_cache_when_sync_draft_workflow import handle
|
||||
from .delete_workflow_as_tool_when_app_deleted import handle
|
||||
from .update_app_dataset_join_when_app_model_config_updated import handle
|
||||
|
@ -0,0 +1,11 @@
|
||||
from events.app_event import app_was_deleted
|
||||
from extensions.ext_database import db
|
||||
from models.model import Site
|
||||
|
||||
|
||||
@app_was_deleted.connect
|
||||
def handle(sender, **kwargs):
|
||||
app = sender
|
||||
site = db.session.query(Site).filter(Site.app_id == app.id).first()
|
||||
db.session.delete(site)
|
||||
db.session.commit()
|
Loading…
Reference in New Issue
Block a user