@@ -15,7 +15,7 @@ def is_enabled(self) -> bool:
1515
1616 def db_for_read (self , model : type [Model ], ** hints : None ) -> str | None :
1717 """
18- If enabled, route "task_processor" models to the a se database
18+ If enabled, route read operations to the task processor database
1919 """
2020 if not self .is_enabled :
2121 return None
@@ -27,7 +27,7 @@ def db_for_read(self, model: type[Model], **hints: None) -> str | None:
2727
2828 def db_for_write (self , model : type [Model ], ** hints : None ) -> str | None :
2929 """
30- Attempts to write task processor models go to 'task_processor' database.
30+ If enabled, route write operations to the task processor database
3131 """
3232 if not self .is_enabled :
3333 return None
@@ -39,8 +39,7 @@ def db_for_write(self, model: type[Model], **hints: None) -> str | None:
3939
4040 def allow_relation (self , obj1 : Model , obj2 : Model , ** hints : None ) -> bool | None :
4141 """
42- Relations between objects are allowed if both objects are
43- in the task processor database.
42+ If enabled, allow relations between task processor models
4443 """
4544 if not self .is_enabled :
4645 return None
@@ -62,11 +61,16 @@ def allow_migrate(
6261 ** hints : None ,
6362 ) -> bool | None :
6463 """
65- Allow migrations for task processor models to run in both databases
64+ If enabled, allow migrations to hit both databases
6665
67- NOTE: Even if, from a fresh install, the task processor tables are not
68- required in both databases, this is required to allow for easier
69- transition between a single database and a multi-database setup.
66+ NOTE: We run migrations on both databases because:
67+
68+ - The `task_processor` separate database was only introduced later in
69+ history, and migrating to it does not delete old data from `default`.
70+ We'd rather keep data in `default` consistent across time rather than
71+ leaving behind possibly inconsistent data.
72+ - We want to make it easier to migrate to the new database, _or back_
73+ to a single database setup if needed. Running DDL consistently helps.
7074 """
7175 if not self .is_enabled :
7276 return None
0 commit comments