Removed the random_pk type alias, because autoincrement=False does not seem to work with it.

This commit is contained in:
依瑪貓 2023-04-24 23:29:58 +08:00
parent 167990fc4c
commit e083b11394

View File

@ -112,7 +112,7 @@ class Account(db.Model):
"""An account.""" """An account."""
__tablename__ = "accounting_accounts" __tablename__ = "accounting_accounts"
"""The table name.""" """The table name."""
id: Mapped[random_pk] id: Mapped[int] = mapped_column(primary_key=True, autoincrement=False)
"""The account ID.""" """The account ID."""
base_code: Mapped[str] \ base_code: Mapped[str] \
= mapped_column(db.ForeignKey(BaseAccount.code, onupdate="CASCADE", = mapped_column(db.ForeignKey(BaseAccount.code, onupdate="CASCADE",
@ -535,7 +535,7 @@ class JournalEntry(db.Model):
"""A journal entry.""" """A journal entry."""
__tablename__ = "accounting_journal_entries" __tablename__ = "accounting_journal_entries"
"""The table name.""" """The table name."""
id: Mapped[random_pk] id: Mapped[int] = mapped_column(primary_key=True, autoincrement=False)
"""The journal entry ID.""" """The journal entry ID."""
date: Mapped[dt.date] date: Mapped[dt.date]
"""The date.""" """The date."""
@ -646,7 +646,7 @@ class JournalEntryLineItem(db.Model):
"""A line item in the journal entry.""" """A line item in the journal entry."""
__tablename__ = "accounting_journal_entry_line_items" __tablename__ = "accounting_journal_entry_line_items"
"""The table name.""" """The table name."""
id: Mapped[random_pk] = mapped_column() id: Mapped[int] = mapped_column(primary_key=True, autoincrement=False)
"""The line item ID.""" """The line item ID."""
journal_entry_id: Mapped[int] \ journal_entry_id: Mapped[int] \
= mapped_column(db.ForeignKey(JournalEntry.id, onupdate="CASCADE", = mapped_column(db.ForeignKey(JournalEntry.id, onupdate="CASCADE",