From 84346163a3ba2e8c74f61d0361e5cd91bbe2d4b3 Mon Sep 17 00:00:00 2001 From: Zvonimir Sabljic Date: Wed, 2 Aug 2023 10:41:46 +0200 Subject: [PATCH] Fixed drop_tables function --- euclid/database/database.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/euclid/database/database.py b/euclid/database/database.py index 96bbd75..7e96af5 100644 --- a/euclid/database/database.py +++ b/euclid/database/database.py @@ -143,19 +143,10 @@ def create_tables(): def drop_tables(): - with database: - database.drop_tables([ - User, - App, - ProjectDescription, - UserStories, - UserTasks, - Architecture, - DevelopmentPlanning, - DevelopmentSteps, - EnvironmentSetup, - Development - ]) + with database.atomic(): + for table in [User, App, ProjectDescription, UserStories, UserTasks, Architecture, DevelopmentPlanning, DevelopmentSteps, EnvironmentSetup, Development]: + database.execute_sql(f'DROP TABLE IF EXISTS "{table._meta.table_name}" CASCADE') + if __name__ == "__main__":