add PackageBlacklist SQLAlchemy ORM model

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-06-11 17:28:08 -07:00
parent 163e4d7389
commit 511f174c8b
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,20 @@
from sqlalchemy import Column, Integer
from sqlalchemy.exc import IntegrityError
from aurweb.models.declarative import Base
class PackageBlacklist(Base):
__tablename__ = "PackageBlacklist"
ID = Column(Integer, primary_key=True)
__mapper_args__ = {"primary_key": [ID]}
def __init__(self, Name: str = None):
self.Name = Name
if not self.Name:
raise IntegrityError(
statement="Column Name cannot be null.",
orig="PackageBlacklist.Name",
params=("NULL"))