mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
remove history-meta for templates, replace with hand-made history table
history-meta's dynamic magic is insufficient for templates, where we need to be able to refer to the specific history table to take advantage of sqlalchemy's relationship management (2/3rds of an ORM). So replace it with a custom made version table. Had to change the version decorator slightly for this
This commit is contained in:
@@ -16,6 +16,7 @@ from app.models import (
|
||||
VerifyCode,
|
||||
ApiKey,
|
||||
Template,
|
||||
TemplateHistory,
|
||||
Job,
|
||||
NotificationHistory,
|
||||
Notification,
|
||||
@@ -122,7 +123,7 @@ def delete_service_and_all_associated_db_objects(service):
|
||||
_delete_commit(Notification.query.filter_by(service=service))
|
||||
_delete_commit(Job.query.filter_by(service=service))
|
||||
_delete_commit(Template.query.filter_by(service=service))
|
||||
_delete_commit(Template.get_history_model().query.filter_by(service_id=service.id))
|
||||
_delete_commit(TemplateHistory.query.filter_by(service_id=service.id))
|
||||
|
||||
verify_codes = VerifyCode.query.join(User).filter(User.id.in_([x.id for x in service.users]))
|
||||
list(map(db.session.delete, verify_codes))
|
||||
|
||||
Reference in New Issue
Block a user