(_db)
| 158 | |
| 159 | |
| 160 | def _clean_database(_db): |
| 161 | _db.session.remove() |
| 162 | _db.session_bulk.remove() |
| 163 | for tbl in reversed(_db.metadata.sorted_tables): |
| 164 | if tbl.name not in [ |
| 165 | "provider_details", |
| 166 | "key_types", |
| 167 | "branding_type", |
| 168 | "job_status", |
| 169 | "provider_details_history", |
| 170 | "template_process_type", |
| 171 | "notifications_all_time_view", |
| 172 | "notification_status_types", |
| 173 | "organisation_types", |
| 174 | "service_permission_types", |
| 175 | "auth_type", |
| 176 | "invite_status_type", |
| 177 | "service_callback_type", |
| 178 | "default_annual_allowance", |
| 179 | ]: |
| 180 | stmt = delete(tbl) |
| 181 | _db.session.execute(stmt) |
| 182 | _db.session.commit() |
| 183 | |
| 184 | |
| 185 | # based on https://github.com/sqlalchemy/sqlalchemy/issues/5709#issuecomment-729689097 |
no outgoing calls
no test coverage detected