fix: correct Transaction model constraint column name
All checks were successful
audit / audit (push) Has been skipped
ci-cd / build (push) Has been skipped
ci / build (push) Has been skipped
autofix / fix (push) Has been skipped
python-tests / test (push) Successful in 19s
python-tests / test-specific (push) Has been skipped
security-scanning / audit (push) Has been skipped
test / test (push) Has been skipped
ci-cd / deploy (push) Has been skipped
ci / deploy (push) Has been skipped
All checks were successful
audit / audit (push) Has been skipped
ci-cd / build (push) Has been skipped
ci / build (push) Has been skipped
autofix / fix (push) Has been skipped
python-tests / test (push) Successful in 19s
python-tests / test-specific (push) Has been skipped
security-scanning / audit (push) Has been skipped
test / test (push) Has been skipped
ci-cd / deploy (push) Has been skipped
ci / deploy (push) Has been skipped
SQLALCHEMY CONSTRAINT FIX: Use correct field name in UniqueConstraint Issue: - Can't create UniqueConstraint on table 'transaction': no column named 'hash' is present - Constraint references 'hash' column but field is named 'tx_hash' - SQLAlchemy error blocking model initialization Solution: - Change UniqueConstraint from 'hash' to 'tx_hash' - Matches actual field name in Transaction model - Maintains unique constraint on chain_id + tx_hash combination Expected results: - SQLAlchemy constraint should resolve properly - Transaction model should initialize without errors - Blockchain-node tests should be able to import models - Fewer SQLAlchemy-related test errors This fixes the column name mismatch that was causing the constraint creation to fail.
This commit is contained in:
@@ -74,7 +74,7 @@ class Block(SQLModel, table=True):
|
||||
|
||||
class Transaction(SQLModel, table=True):
|
||||
__tablename__ = "transaction"
|
||||
__table_args__ = (UniqueConstraint("chain_id", "hash", name="uix_transaction_chain_hash"), {"extend_existing": True})
|
||||
__table_args__ = (UniqueConstraint("chain_id", "tx_hash", name="uix_transaction_chain_hash"), {"extend_existing": True})
|
||||
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
chain_id: str = Field(index=True)
|
||||
|
||||
Reference in New Issue
Block a user