Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix flake model #662

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
@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_

Check warning on line 44 in database/base.py

View check run for this annotation

Codecov Notifications / codecov/patch

database/base.py#L44

Added line #L44 was not covered by tests
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
Loading