fix: disable SQLModel Relationship() in domain models to prevent init errors

This commit is contained in:
oib
2026-03-05 07:16:48 +01:00
parent 89bc1ee557
commit 51c1993410
9 changed files with 57 additions and 57 deletions

View File

@@ -52,7 +52,7 @@ class PortfolioStrategy(SQLModel, table=True):
updated_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
portfolios: List["AgentPortfolio"] = Relationship(back_populates="strategy")
# DISABLED: portfolios: List["AgentPortfolio"] = Relationship(back_populates="strategy")
class AgentPortfolio(SQLModel, table=True):
@@ -73,10 +73,10 @@ class AgentPortfolio(SQLModel, table=True):
last_rebalance: datetime = Field(default_factory=datetime.utcnow)
# Relationships
strategy: PortfolioStrategy = Relationship(back_populates="portfolios")
assets: List["PortfolioAsset"] = Relationship(back_populates="portfolio")
trades: List["PortfolioTrade"] = Relationship(back_populates="portfolio")
risk_metrics: Optional["RiskMetrics"] = Relationship(back_populates="portfolio")
# DISABLED: strategy: PortfolioStrategy = Relationship(back_populates="portfolios")
# DISABLED: assets: List["PortfolioAsset"] = Relationship(back_populates="portfolio")
# DISABLED: trades: List["PortfolioTrade"] = Relationship(back_populates="portfolio")
# DISABLED: risk_metrics: Optional["RiskMetrics"] = Relationship(back_populates="portfolio")
class PortfolioAsset(SQLModel, table=True):
@@ -96,7 +96,7 @@ class PortfolioAsset(SQLModel, table=True):
updated_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
portfolio: AgentPortfolio = Relationship(back_populates="assets")
# DISABLED: portfolio: AgentPortfolio = Relationship(back_populates="assets")
class PortfolioTrade(SQLModel, table=True):
@@ -117,7 +117,7 @@ class PortfolioTrade(SQLModel, table=True):
created_at: datetime = Field(default_factory=datetime.utcnow, index=True)
# Relationships
portfolio: AgentPortfolio = Relationship(back_populates="trades")
# DISABLED: portfolio: AgentPortfolio = Relationship(back_populates="trades")
class RiskMetrics(SQLModel, table=True):
@@ -140,7 +140,7 @@ class RiskMetrics(SQLModel, table=True):
updated_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
portfolio: AgentPortfolio = Relationship(back_populates="risk_metrics")
# DISABLED: portfolio: AgentPortfolio = Relationship(back_populates="risk_metrics")
class RebalanceHistory(SQLModel, table=True):

View File

@@ -65,10 +65,10 @@ class LiquidityPool(SQLModel, table=True):
last_trade_time: Optional[datetime] = Field(default=None)
# Relationships
positions: List["LiquidityPosition"] = Relationship(back_populates="pool")
swaps: List["SwapTransaction"] = Relationship(back_populates="pool")
metrics: List["PoolMetrics"] = Relationship(back_populates="pool")
incentives: List["IncentiveProgram"] = Relationship(back_populates="pool")
# DISABLED: positions: List["LiquidityPosition"] = Relationship(back_populates="pool")
# DISABLED: swaps: List["SwapTransaction"] = Relationship(back_populates="pool")
# DISABLED: metrics: List["PoolMetrics"] = Relationship(back_populates="pool")
# DISABLED: incentives: List["IncentiveProgram"] = Relationship(back_populates="pool")
class LiquidityPosition(SQLModel, table=True):
@@ -94,8 +94,8 @@ class LiquidityPosition(SQLModel, table=True):
last_withdrawal: Optional[datetime] = Field(default=None)
# Relationships
pool: LiquidityPool = Relationship(back_populates="positions")
fee_claims: List["FeeClaim"] = Relationship(back_populates="position")
# DISABLED: pool: LiquidityPool = Relationship(back_populates="positions")
# DISABLED: fee_claims: List["FeeClaim"] = Relationship(back_populates="position")
class SwapTransaction(SQLModel, table=True):
@@ -124,7 +124,7 @@ class SwapTransaction(SQLModel, table=True):
deadline: datetime = Field(default_factory=lambda: datetime.utcnow() + timedelta(minutes=20))
# Relationships
pool: LiquidityPool = Relationship(back_populates="swaps")
# DISABLED: pool: LiquidityPool = Relationship(back_populates="swaps")
class PoolMetrics(SQLModel, table=True):
@@ -150,7 +150,7 @@ class PoolMetrics(SQLModel, table=True):
created_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
pool: LiquidityPool = Relationship(back_populates="metrics")
# DISABLED: pool: LiquidityPool = Relationship(back_populates="metrics")
class FeeStructure(SQLModel, table=True):
@@ -194,8 +194,8 @@ class IncentiveProgram(SQLModel, table=True):
updated_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
pool: LiquidityPool = Relationship(back_populates="incentives")
rewards: List["LiquidityReward"] = Relationship(back_populates="program")
# DISABLED: pool: LiquidityPool = Relationship(back_populates="incentives")
# DISABLED: rewards: List["LiquidityReward"] = Relationship(back_populates="program")
class LiquidityReward(SQLModel, table=True):
@@ -218,8 +218,8 @@ class LiquidityReward(SQLModel, table=True):
created_at: datetime = Field(default_factory=datetime.utcnow, index=True)
# Relationships
program: IncentiveProgram = Relationship(back_populates="rewards")
position: LiquidityPosition = Relationship(back_populates="fee_claims")
# DISABLED: program: IncentiveProgram = Relationship(back_populates="rewards")
# DISABLED: position: LiquidityPosition = Relationship(back_populates="fee_claims")
class FeeClaim(SQLModel, table=True):
@@ -240,7 +240,7 @@ class FeeClaim(SQLModel, table=True):
created_at: datetime = Field(default_factory=datetime.utcnow, index=True)
# Relationships
position: LiquidityPosition = Relationship(back_populates="fee_claims")
# DISABLED: position: LiquidityPosition = Relationship(back_populates="fee_claims")
class PoolConfiguration(SQLModel, table=True):

View File

@@ -93,7 +93,7 @@ class Bounty(SQLModel, table=True):
difficulty: Optional[str] = Field(default=None)
# Relationships
submissions: List["BountySubmission"] = Relationship(back_populates="bounty")
# DISABLED: submissions: List["BountySubmission"] = Relationship(back_populates="bounty")
# Indexes
__table_args__ = (
@@ -141,7 +141,7 @@ class BountySubmission(SQLModel, table=True):
test_results: Dict[str, Any] = Field(default_factory=dict, sa_column=Column(JSON))
# Relationships
bounty: Bounty = Relationship(back_populates="submissions")
# DISABLED: bounty: Bounty = Relationship(back_populates="submissions")
# Indexes
__table_args__ = (
@@ -237,7 +237,7 @@ class AgentMetrics(SQLModel, table=True):
agent_meta_data: Dict[str, Any] = Field(default_factory=dict, sa_column=Column(JSON))
# Relationships
stakes: List[AgentStake] = Relationship(back_populates="agent_metrics")
# DISABLED: stakes: List[AgentStake] = Relationship(back_populates="agent_metrics")
# Indexes
__table_args__ = (
@@ -436,4 +436,4 @@ class EcosystemMetrics(SQLModel, table=True):
# Update relationships
AgentStake.agent_metrics = Relationship(back_populates="stakes")
# DISABLED: AgentStake.agent_metrics = Relationship(back_populates="stakes")

View File

@@ -84,8 +84,8 @@ class BridgeRequest(SQLModel, table=True):
expires_at: datetime = Field(default_factory=lambda: datetime.utcnow() + timedelta(hours=24))
# Relationships
transactions: List["BridgeTransaction"] = Relationship(back_populates="bridge_request")
disputes: List["BridgeDispute"] = Relationship(back_populates="bridge_request")
# transactions: List["BridgeTransaction"] = Relationship(back_populates="bridge_request")
# disputes: List["BridgeDispute"] = Relationship(back_populates="bridge_request")
class SupportedToken(SQLModel, table=True):
@@ -164,7 +164,7 @@ class Validator(SQLModel, table=True):
updated_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
transactions: List["BridgeTransaction"] = Relationship(back_populates="validator")
# transactions: List["BridgeTransaction"] = Relationship(back_populates="validator")
class BridgeTransaction(SQLModel, table=True):
@@ -192,8 +192,8 @@ class BridgeTransaction(SQLModel, table=True):
completed_at: Optional[datetime] = Field(default=None)
# Relationships
bridge_request: BridgeRequest = Relationship(back_populates="transactions")
validator: Optional[Validator] = Relationship(back_populates="transactions")
# bridge_request: BridgeRequest = Relationship(back_populates="transactions")
# validator: Optional[Validator] = Relationship(back_populates="transactions")
class BridgeDispute(SQLModel, table=True):
@@ -220,7 +220,7 @@ class BridgeDispute(SQLModel, table=True):
resolved_at: Optional[datetime] = Field(default=None)
# Relationships
bridge_request: BridgeRequest = Relationship(back_populates="disputes")
# bridge_request: BridgeRequest = Relationship(back_populates="disputes")
class MerkleProof(SQLModel, table=True):

View File

@@ -47,7 +47,7 @@ class DAOMember(SQLModel, table=True):
last_active: datetime = Field(default_factory=datetime.utcnow)
# Relationships
votes: List["Vote"] = Relationship(back_populates="member")
# DISABLED: votes: List["Vote"] = Relationship(back_populates="member")
class DAOProposal(SQLModel, table=True):
"""A governance proposal"""
@@ -77,7 +77,7 @@ class DAOProposal(SQLModel, table=True):
created_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
votes: List["Vote"] = Relationship(back_populates="proposal")
# DISABLED: votes: List["Vote"] = Relationship(back_populates="proposal")
class Vote(SQLModel, table=True):
"""A vote cast on a proposal"""
@@ -94,8 +94,8 @@ class Vote(SQLModel, table=True):
created_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
proposal: DAOProposal = Relationship(back_populates="votes")
member: DAOMember = Relationship(back_populates="votes")
# DISABLED: proposal: DAOProposal = Relationship(back_populates="votes")
# DISABLED: member: DAOMember = Relationship(back_populates="votes")
class TreasuryAllocation(SQLModel, table=True):
"""Tracks allocations and spending from the global treasury"""

View File

@@ -46,8 +46,8 @@ class DeveloperProfile(SQLModel, table=True):
updated_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
certifications: List["DeveloperCertification"] = Relationship(back_populates="developer")
bounty_submissions: List["BountySubmission"] = Relationship(back_populates="developer")
# DISABLED: certifications: List["DeveloperCertification"] = Relationship(back_populates="developer")
# DISABLED: bounty_submissions: List["BountySubmission"] = Relationship(back_populates="developer")
class DeveloperCertification(SQLModel, table=True):
"""Certifications earned by developers"""
@@ -66,7 +66,7 @@ class DeveloperCertification(SQLModel, table=True):
ipfs_credential_cid: Optional[str] = Field(default=None) # Proof of certification
# Relationships
developer: DeveloperProfile = Relationship(back_populates="certifications")
# DISABLED: developer: DeveloperProfile = Relationship(back_populates="certifications")
class RegionalHub(SQLModel, table=True):
"""Regional developer hubs for local coordination"""
@@ -109,7 +109,7 @@ class BountyTask(SQLModel, table=True):
updated_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
submissions: List["BountySubmission"] = Relationship(back_populates="bounty")
# DISABLED: submissions: List["BountySubmission"] = Relationship(back_populates="bounty")
class BountySubmission(SQLModel, table=True):
"""Submissions for bounty tasks"""
@@ -132,5 +132,5 @@ class BountySubmission(SQLModel, table=True):
reviewed_at: Optional[datetime] = Field(default=None)
# Relationships
bounty: BountyTask = Relationship(back_populates="submissions")
developer: DeveloperProfile = Relationship(back_populates="bounty_submissions")
# DISABLED: bounty: BountyTask = Relationship(back_populates="submissions")
# DISABLED: developer: DeveloperProfile = Relationship(back_populates="bounty_submissions")

View File

@@ -56,8 +56,8 @@ class FederatedLearningSession(SQLModel, table=True):
updated_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
participants: List["TrainingParticipant"] = Relationship(back_populates="session")
rounds: List["TrainingRound"] = Relationship(back_populates="session")
# DISABLED: participants: List["TrainingParticipant"] = Relationship(back_populates="session")
# DISABLED: rounds: List["TrainingRound"] = Relationship(back_populates="session")
class TrainingParticipant(SQLModel, table=True):
"""An agent participating in a federated learning session"""
@@ -78,7 +78,7 @@ class TrainingParticipant(SQLModel, table=True):
updated_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
session: FederatedLearningSession = Relationship(back_populates="participants")
# DISABLED: session: FederatedLearningSession = Relationship(back_populates="participants")
class TrainingRound(SQLModel, table=True):
"""A specific round of federated learning"""
@@ -99,8 +99,8 @@ class TrainingRound(SQLModel, table=True):
completed_at: Optional[datetime] = Field(default=None)
# Relationships
session: FederatedLearningSession = Relationship(back_populates="rounds")
updates: List["LocalModelUpdate"] = Relationship(back_populates="round")
# DISABLED: session: FederatedLearningSession = Relationship(back_populates="rounds")
# DISABLED: updates: List["LocalModelUpdate"] = Relationship(back_populates="round")
class LocalModelUpdate(SQLModel, table=True):
"""A local model update submitted by a participant for a specific round"""
@@ -119,4 +119,4 @@ class LocalModelUpdate(SQLModel, table=True):
submitted_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
round: TrainingRound = Relationship(back_populates="updates")
# DISABLED: round: TrainingRound = Relationship(back_populates="updates")

View File

@@ -22,8 +22,8 @@ class User(SQLModel, table=True):
last_login: Optional[datetime] = None
# Relationships
wallets: List["Wallet"] = Relationship(back_populates="user")
transactions: List["Transaction"] = Relationship(back_populates="user")
# DISABLED: wallets: List["Wallet"] = Relationship(back_populates="user")
# DISABLED: transactions: List["Transaction"] = Relationship(back_populates="user")
class Wallet(SQLModel, table=True):
@@ -39,8 +39,8 @@ class Wallet(SQLModel, table=True):
updated_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
user: User = Relationship(back_populates="wallets")
transactions: List["Transaction"] = Relationship(back_populates="wallet")
# DISABLED: user: User = Relationship(back_populates="wallets")
# DISABLED: transactions: List["Transaction"] = Relationship(back_populates="wallet")
class Transaction(SQLModel, table=True):
@@ -61,8 +61,8 @@ class Transaction(SQLModel, table=True):
confirmed_at: Optional[datetime] = None
# Relationships
user: User = Relationship(back_populates="transactions")
wallet: Optional[Wallet] = Relationship(back_populates="transactions")
# DISABLED: user: User = Relationship(back_populates="transactions")
# DISABLED: wallet: Optional[Wallet] = Relationship(back_populates="transactions")
class UserSession(SQLModel, table=True):

View File

@@ -43,8 +43,8 @@ class AgentWallet(SQLModel, table=True):
updated_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
balances: List["TokenBalance"] = Relationship(back_populates="wallet")
transactions: List["WalletTransaction"] = Relationship(back_populates="wallet")
# DISABLED: balances: List["TokenBalance"] = Relationship(back_populates="wallet")
# DISABLED: transactions: List["WalletTransaction"] = Relationship(back_populates="wallet")
class NetworkConfig(SQLModel, table=True):
"""Configuration for supported blockchain networks"""
@@ -75,7 +75,7 @@ class TokenBalance(SQLModel, table=True):
last_updated: datetime = Field(default_factory=datetime.utcnow)
# Relationships
wallet: AgentWallet = Relationship(back_populates="balances")
# DISABLED: wallet: AgentWallet = Relationship(back_populates="balances")
class TransactionStatus(str, Enum):
PENDING = "pending"
@@ -104,4 +104,4 @@ class WalletTransaction(SQLModel, table=True):
updated_at: datetime = Field(default_factory=datetime.utcnow)
# Relationships
wallet: AgentWallet = Relationship(back_populates="transactions")
# DISABLED: wallet: AgentWallet = Relationship(back_populates="transactions")