fix(models.package_source): fix primary key constraints

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-12-21 15:26:25 -08:00
parent 22093c5c38
commit 5142447b7e
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
3 changed files with 12 additions and 5 deletions

View file

@ -10,7 +10,10 @@ class PackageSource(Base):
__table__ = schema.PackageSources
__tablename__ = __table__.name
__mapper_args__ = {
"primary_key": [__table__.c.PackageID]
"primary_key": [
__table__.c.PackageID,
__table__.c.Source
]
}
Package = relationship(
@ -26,3 +29,6 @@ class PackageSource(Base):
statement="Foreign key PackageID cannot be null.",
orig="PackageSources.PackageID",
params=("NULL"))
if not self.Source:
self.Source = "/dev/null"