Solution is disabling update if already done

This commit is contained in:
Silversthorn 2024-03-23 12:11:43 +01:00
parent c00cb1a61d
commit 8f8feef6de
2 changed files with 11 additions and 2 deletions

View File

@ -372,8 +372,10 @@ class MigrationManager(object):
Create migrator Create migrator
""" """
migrator = Migrator(self.database) migrator = Migrator(self.database)
# Creating false migrations from the # Running false migrations to retrives the schemes of
for name in self.diff: # the precedents created tables in the table_dict element
# It's useful to run the new migrations
for name in self.done:
self.up_one(name, migrator, True) self.up_one(name, migrator, True)
return migrator return migrator

View File

@ -22,6 +22,13 @@ def migrate(migrator: Migrator, database, **kwargs):
""" """
db = database db = database
this_migration = MigrateHistory.get(MigrateHistory.name == "20240216_rework_servers_uuid_part2")
if this_migration:
Console.debug("Update database already done, skipping this migration")
return
else :
Console.debug("Update database not done, doing : Migration Data from Int to UUID")
# ********************************************************************************** # **********************************************************************************
# Servers New Model from Old (easier to migrate without dunmping Database) # Servers New Model from Old (easier to migrate without dunmping Database)
# ********************************************************************************** # **********************************************************************************