data.database: add RepositoryKind
This commit is contained in:
parent
0ea600628b
commit
5b362da8ac
1 changed files with 5 additions and 1 deletions
|
@ -341,7 +341,6 @@ class QuayUserField(ForeignKeyField):
|
|||
super(QuayUserField, self).__init__(*args, **kwargs)
|
||||
|
||||
|
||||
# @TODO: Generates client-side enum
|
||||
class EnumField(ForeignKeyField):
|
||||
""" Create a cached python Enum from an EnumTable """
|
||||
def __init__(self, rel_model, enum_key_field='name', *args, **kwargs):
|
||||
|
@ -549,12 +548,17 @@ class Visibility(BaseModel):
|
|||
name = CharField(index=True, unique=True)
|
||||
|
||||
|
||||
class RepositoryKind(BaseModel):
|
||||
name = CharField(index=True, unique=True)
|
||||
|
||||
|
||||
class Repository(BaseModel):
|
||||
namespace_user = QuayUserField(null=True)
|
||||
name = FullIndexedCharField(match_function=db_match_func)
|
||||
visibility = ForeignKeyField(Visibility)
|
||||
description = FullIndexedTextField(match_function=db_match_func, null=True)
|
||||
badge_token = CharField(default=uuid_generator)
|
||||
kind = EnumField(RepositoryKind)
|
||||
|
||||
class Meta:
|
||||
database = db
|
||||
|
|
Reference in a new issue