fix(migrations): version/description as class vars, not instance vars in Migration base
__init__ was setting self.version = "0000-00-00-000000" on every instantiation, overriding the subclass class variable. All migrations were recorded in DB with the default version instead of their own, causing duplicate key errors. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
89fa87ba8a
commit
ea30425a63
1 changed files with 4 additions and 3 deletions
|
|
@ -17,10 +17,11 @@ logger = get_logger(__name__)
|
|||
|
||||
class Migration(ABC):
|
||||
"""Base class for database migrations."""
|
||||
|
||||
|
||||
version: str = "0000-00-00-000000" # overridden by subclass as class variable
|
||||
description: str = ""
|
||||
|
||||
def __init__(self):
|
||||
self.version: str = "0000-00-00-000000" # Format: YYYY-MM-DD-HHMMSS
|
||||
self.description: str = ""
|
||||
self.db: Optional[AsyncIOMotorDatabase] = None
|
||||
|
||||
@abstractmethod
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue