Fix: errors on models from generating database.
This commit is contained in:
@@ -10,5 +10,4 @@ url = "sqlite:///database/dakiny.db"
|
||||
dakiny_logger.info("Connected to local dev database.")
|
||||
engine = create_engine(url)
|
||||
|
||||
# Don't need to create all when connected to prod.
|
||||
SQLModel.metadata.create_all(engine)
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user