Skip to content

Commit

Permalink
fix flake model (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-sentry authored Aug 29, 2024
1 parent 894f2b3 commit 3cdf975
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions database/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,15 @@ class MixinBaseClass(object):
@property
def id(self):
return self.id_


class MixinBaseClassNoExternalID(object):
id_ = Column("id", types.BigInteger, primary_key=True)
created_at = Column(types.DateTime(timezone=True), default=get_utc_now)
updated_at = Column(
types.DateTime(timezone=True), onupdate=get_utc_now, default=get_utc_now
)

@property
def id(self):
return self.id_
4 changes: 2 additions & 2 deletions database/models/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import backref, relationship

from database.base import CodecovBaseModel, MixinBaseClass
from database.base import CodecovBaseModel, MixinBaseClass, MixinBaseClassNoExternalID
from database.models.core import Commit, CompareCommit, Repository
from database.utils import ArchiveField
from helpers.clock import get_utc_now
Expand Down Expand Up @@ -332,7 +332,7 @@ class ReducedError(CodecovBaseModel, MixinBaseClass):
message = Column(types.Text)


class Flake(CodecovBaseModel, MixinBaseClass):
class Flake(CodecovBaseModel, MixinBaseClassNoExternalID):
__tablename__ = "reports_flake"
repoid = Column(types.Integer, ForeignKey("repos.repoid"))
repository = relationship("Repository", backref=backref("flakes"))
Expand Down

0 comments on commit 3cdf975

Please sign in to comment.