Fix: errors on models from generating database.

This commit is contained in:
2025-07-17 09:14:51 -04:00
parent 3eea225931
commit 6b60c37726
2 changed files with 7 additions and 4 deletions
+7 -3
View File
@@ -19,6 +19,8 @@ class ElectionInformation(SQLModel, table=True):
votes: All votes cast during this election.
"""
__tablename__: str = "ElectionInformation"
name: str = Field(sa_column=Column("ElectionName", VARCHAR, primary_key=True, unique=True), max_length=30)
thread_id: int = Field(sa_column=Column("ThreadId", BIGINT(unsigned=True), nullable=False))
council_vote_msg_id: int | None = Field(
@@ -109,9 +111,11 @@ class Vote(SQLModel, table=True):
voter_id: int = Field(sa_column=Column("VoterId", BIGINT(unsigned=True), primary_key=True, nullable=False))
# might have to set this foreign key later with alembic migration...
voted_for_id: int | None = Field(
sa_column=Column("VotedForId", BIGINT(unsigned=True), ForeignKey("CouncilMembers.member_id"), nullable=True)
sa_column=Column("VotedForId", BIGINT(unsigned=True), ForeignKey("CouncilMembers.MemberId"), nullable=True)
)
type: str = Field(
sa_column=Column("Type", VARCHAR, primary_key=True, nullable=False, default="council"), max_length=14
)
type: str = Field(sa_column=Column("Type", primary_key=True, nullable=False, default="council"), max_length=14)
election: ElectionInformation | None = Relationship(back_populates="votes")
council_member: CouncilMember | None = Relationship(back_populates="votes")
@@ -184,7 +188,7 @@ class Message(SQLModel, table=True):
__tablename__: str = "Messages"
path: str = Field(sa_column=Column("Path", primary_key=True, nullable=False), max_length=100)
path: str = Field(sa_column=Column("Path", VARCHAR, primary_key=True, nullable=False), max_length=100)
id: int = Field(sa_column=Column("Id", BIGINT(unsigned=True), nullable=False))