async-easy-model 0.1.12__py3-none-any.whl → 0.2.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ from typing import Optional, Any
6
6
  from .model import EasyModel, init_db, db_config
7
7
  from sqlmodel import Field, Relationship as SQLModelRelationship
8
8
 
9
- __version__ = "0.1.12"
9
+ __version__ = "0.2.2"
10
10
  __all__ = ["EasyModel", "init_db", "db_config", "Field", "Relationship", "Relation", "enable_auto_relationships", "disable_auto_relationships", "process_auto_relationships", "MigrationManager", "check_and_migrate_models"]
11
11
 
12
12
  # Create a more user-friendly Relationship function
@@ -22,8 +22,20 @@ _auto_processed_models = set()
22
22
  _auto_relationships_processed = False
23
23
 
24
24
  # Flag to enable/disable automatic relationship detection
25
+ # Disabled by default and will be enabled during init_db
25
26
  _auto_relationships_enabled = False
26
27
 
28
+ # Automatically disable auto-relationships at module import time
29
+ # This ensures models can be defined without immediate processing
30
+ def _disable_auto_relationships_on_import():
31
+ # This will be automatically called when the module is imported
32
+ global _auto_relationships_enabled
33
+ _auto_relationships_enabled = False
34
+ logger.info("Auto relationships disabled by default at import")
35
+
36
+ # Call the function immediately when this module is imported
37
+ _disable_auto_relationships_on_import()
38
+
27
39
  def pluralize_name(name: str) -> str:
28
40
  """Convert a singular noun to its plural form."""
29
41
  # Check if the name already ends with 's'