class FieldTag(db.Model):
    """Represents a FieldTag record."""
    __tablename__ = 'field_tag'
    id_field = db.Column(db.MediumInteger(9, unsigned=True),
                         db.ForeignKey('field.id'),
                         nullable=False,
                         primary_key=True)
    id_tag = db.Column(db.MediumInteger(9, unsigned=True),
                       db.ForeignKey('tag.id'),
                       nullable=False,
                       primary_key=True)
    score = db.Column(db.TinyInteger(4, unsigned=True),
                      nullable=False,
                      server_default='0')
    tag = db.relationship(Tag, backref='fields', order_by=score)
    field = db.relationship(Field, backref='tags', order_by=score)

    def __init__(self, score=None, tup=None, *args, **kwargs):
        if score is not None:
            self.score = score
        if tup is not None:
            self.tag = Tag(tup)
        super(FieldTag, self).__init__(*args, **kwargs)

    @property
    def as_tag(self):
        """ Returns Tag record directly."""
        return self.tag
class CollectionFieldFieldvalue(db.Model):
    """Represents a CollectionFieldFieldvalue record."""
    __tablename__ = 'collection_field_fieldvalue'
    id_collection = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(Collection.id),
                              primary_key=True,
                              nullable=False)
    id_field = db.Column(db.MediumInteger(9, unsigned=True),
                         db.ForeignKey(Field.id),
                         primary_key=True,
                         nullable=False)
    id_fieldvalue = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(Fieldvalue.id),
                              primary_key=True,
                              nullable=True)
    type = db.Column(db.Char(3), nullable=False, server_default='src')
    score = db.Column(db.TinyInteger(4, unsigned=True),
                      nullable=False,
                      server_default='0')
    score_fieldvalue = db.Column(db.TinyInteger(4, unsigned=True),
                                 nullable=False,
                                 server_default='0')

    collection = db.relationship(Collection,
                                 backref='field_fieldvalues',
                                 order_by=score)
    field = db.relationship(Field,
                            backref='collection_fieldvalues',
                            lazy='joined')
    fieldvalue = db.relationship(Fieldvalue,
                                 backref='collection_fields',
                                 lazy='joined')
class CollectionExternalcollection(db.Model):
    """Represents a CollectionExternalcollection record."""
    __tablename__ = 'collection_externalcollection'
    id_collection = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(Collection.id),
                              primary_key=True,
                              server_default='0')
    id_externalcollection = db.Column(db.MediumInteger(9, unsigned=True),
                                      db.ForeignKey(Externalcollection.id),
                                      primary_key=True,
                                      server_default='0')
    type = db.Column(db.TinyInteger(4, unsigned=True),
                     server_default='0',
                     nullable=False)

    def _collection_type(type):
        return db.relationship(
            Collection,
            primaryjoin=lambda: db.and_(
                CollectionExternalcollection.id_collection == Collection.id,
                CollectionExternalcollection.type == type),
            backref='_externalcollections_' + str(type))

    collection_0 = _collection_type(0)
    collection_1 = _collection_type(1)
    collection_2 = _collection_type(2)

    externalcollection = db.relationship(Externalcollection)
class OaiHARVESTLOG(db.Model):
    """Represents a OaiHARVESTLOG record."""
    __tablename__ = 'oaiHARVESTLOG'
    id_oaiHARVEST = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(OaiHARVEST.id),
                              nullable=False)
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False,
                          server_default='0')
    bibupload_task_id = db.Column(db.Integer(11),
                                  db.ForeignKey(SchTASK.id),
                                  nullable=False,
                                  server_default='0',
                                  primary_key=True)
    oai_id = db.Column(db.String(40),
                       nullable=False,
                       server_default='',
                       primary_key=True)
    date_harvested = db.Column(db.DateTime,
                               nullable=False,
                               server_default='1900-01-01 00:00:00',
                               primary_key=True)
    date_inserted = db.Column(db.DateTime,
                              nullable=False,
                              server_default='1900-01-01 00:00:00')
    inserted_to_db = db.Column(db.Char(1), nullable=False, server_default='P')
    bibrec = db.relationship(Bibrec, backref='harvestlogs')
    schtask = db.relationship(SchTASK)
Esempio n. 5
0
class RnkDOWNLOADS(db.Model):
    """Represents a RnkDOWNLOADS record."""
    __tablename__ = 'rnkDOWNLOADS'
    id = db.Column(db.Integer,
                   primary_key=True,
                   nullable=False,
                   autoincrement=True)
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=True)
    download_time = db.Column(db.DateTime,
                              nullable=True,
                              server_default='1900-01-01 00:00:00')
    client_host = db.Column(db.Integer(10, unsigned=True), nullable=True)
    id_user = db.Column(db.Integer(15, unsigned=True),
                        db.ForeignKey(User.id),
                        nullable=True)
    id_bibdoc = db.Column(db.MediumInteger(9, unsigned=True),
                          db.ForeignKey(Bibdoc.id),
                          nullable=True)
    file_version = db.Column(db.SmallInteger(2, unsigned=True), nullable=True)
    file_format = db.Column(db.String(50), nullable=True)
    bibrec = db.relationship(Bibrec, backref='downloads')
    bibdoc = db.relationship(Bibdoc, backref='downloads')
    user = db.relationship(User, backref='downloads')
Esempio n. 6
0
class CollectionClsMETHOD(db.Model):
    """Represents a Collection_clsMETHOD record."""
    __tablename__ = 'collection_clsMETHOD'
    id_collection = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(Collection.id),
                              primary_key=True,
                              nullable=False)
    id_clsMETHOD = db.Column(db.MediumInteger(9, unsigned=True),
                             db.ForeignKey(ClsMETHOD.id),
                             primary_key=True,
                             nullable=False)
    collection = db.relationship(Collection, backref='clsMETHODs')
    clsMETHOD = db.relationship(ClsMETHOD, backref='collections')
Esempio n. 7
0
class CrcLOANREQUEST(db.Model):
    """Represents a CrcLOANREQUEST record."""
    def __init__(self):
        pass
    __tablename__ = 'crcLOANREQUEST'
    id = db.Column(db.Integer(15, unsigned=True), nullable=False,
                primary_key=True,
                autoincrement=True)
    id_crcBORROWER = db.Column(db.Integer(15, unsigned=True),
                db.ForeignKey(CrcBORROWER.id), nullable=False, server_default='0')
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                db.ForeignKey(Bibrec.id),
                nullable=False, server_default='0')
    barcode = db.Column(db.String(30), db.ForeignKey(CrcITEM.barcode), nullable=False,
                server_default='')
    period_of_interest_from = db.Column(db.DateTime,
                nullable=False,
                server_default='1900-01-01 00:00:00')
    period_of_interest_to = db.Column(db.DateTime,
                nullable=False,
                server_default='1900-01-01 00:00:00')
    status = db.Column(db.String(20), nullable=False,
                server_default='')
    notes = db.Column(db.Text, nullable=True)
    request_date = db.Column(db.DateTime, nullable=False,
                server_default='1900-01-01 00:00:00')
    borrower = db.relationship(CrcBORROWER, backref='loanrequests')
    bibrec = db.relationship(Bibrec, backref='loanrequests')
    item = db.relationship(CrcITEM, backref='loanrequests')
class LnkENTRY(db.Model):
    """Represents a LnkENTRY record."""
    __tablename__ = 'lnkENTRY'

    id = db.Column(db.Integer(15, unsigned=True),
                   primary_key=True,
                   nullable=False)
    origin_url = db.Column(db.String(100), nullable=False)
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False)
    additional_properties = db.Column(db.Binary)
    type = db.Column(db.String(30), nullable=False, index=True)
    status = db.Column(db.String(30),
                       nullable=False,
                       server_default='PENDING',
                       index=True)
    insert_time = db.Column(db.DateTime,
                            server_default='1900-01-01 00:00:00',
                            index=True)

    @property
    def title(self):
        try:
            return db.object_session(self).query(LnkENTRYURLTITLE).\
                filter(db.and_(
                    LnkENTRYURLTITLE.url==self.origin_url,
                    LnkENTRYURLTITLE.title<>"",
                    LnkENTRYURLTITLE.broken==0)).first().title
        except:
            return self.origin_url
Esempio n. 9
0
class Bibdocfsinfo(db.Model):
    """Represents a Bibdocfsinfo record."""
    __tablename__ = 'bibdocfsinfo'

    id_bibdoc = db.Column(db.MediumInteger(9, unsigned=True),
                          db.ForeignKey(Bibdoc.id),
                          primary_key=True,
                          nullable=False,
                          autoincrement=False)
    version = db.Column(db.TinyInteger(4, unsigned=True),
                        primary_key=True,
                        nullable=False,
                        autoincrement=False)
    format = db.Column(db.String(50),
                       primary_key=True,
                       nullable=False,
                       index=True)
    last_version = db.Column(db.Boolean, nullable=False, index=True)
    cd = db.Column(db.DateTime, nullable=False, index=True)
    md = db.Column(db.DateTime, nullable=False, index=True)
    checksum = db.Column(db.Char(32), nullable=False)
    filesize = db.Column(db.BigInteger(15, unsigned=True),
                         nullable=False,
                         index=True)
    mime = db.Column(db.String(100), nullable=False, index=True)
    master_format = db.Column(db.String(50))
Esempio n. 10
0
class CollectionExample(db.Model):
    """Represents a CollectionExample record."""
    __tablename__ = 'collection_example'
    id_collection = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(Collection.id),
                              primary_key=True)
    id_example = db.Column(db.MediumInteger(9, unsigned=True),
                           db.ForeignKey(Example.id),
                           primary_key=True)
    score = db.Column(db.TinyInteger(4, unsigned=True),
                      nullable=False,
                      server_default='0')
    collection = db.relationship(Collection,
                                 backref='_examples',
                                 order_by=score)
    example = db.relationship(Example, backref='collections', order_by=score)
Esempio n. 11
0
class CrcPURCHASE(db.Model):
    """Represents a CrcPURCHASE record."""
    def __init__(self):
        pass

    __tablename__ = 'crcPURCHASE'
    id = db.Column(db.Integer(15, unsigned=True),
                   nullable=False,
                   primary_key=True,
                   autoincrement=True)
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False,
                          server_default='0')
    id_crcVENDOR = db.Column(db.Integer(15, unsigned=True),
                             db.ForeignKey(CrcVENDOR.id),
                             nullable=False,
                             server_default='0')
    ordered_date = db.Column(db.DateTime,
                             nullable=False,
                             server_default='1900-01-01 00:00:00')
    expected_date = db.Column(db.DateTime,
                              nullable=False,
                              server_default='1900-01-01 00:00:00')
    price = db.Column(db.String(20), nullable=False, server_default='0')
    status = db.Column(db.String(20), nullable=False, server_default='')
    notes = db.Column(db.Text, nullable=True)
    bibrec = db.relationship(Bibrec, backref='purchases')
    vendor = db.relationship(CrcVENDOR, backref='purchases')
Esempio n. 12
0
class CrcITEM(db.Model):
    """Represents a CrcITEM record."""
    def __init__(self):
        pass

    __tablename__ = 'crcITEM'
    barcode = db.Column(db.String(30),
                        nullable=False,
                        server_default='',
                        primary_key=True)
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False,
                          server_default='0')
    id_crcLIBRARY = db.Column(db.Integer(15, unsigned=True),
                              db.ForeignKey(CrcLIBRARY.id),
                              nullable=False,
                              server_default='0')
    collection = db.Column(db.String(60), nullable=True)
    location = db.Column(db.String(60), nullable=True)
    description = db.Column(db.String(60), nullable=True)
    loan_period = db.Column(db.String(30), nullable=False, server_default='')
    status = db.Column(db.String(20), nullable=False, server_default='')
    expected_arrival_date = db.Column(db.String(60),
                                      nullable=False,
                                      server_default='')
    creation_date = db.Column(db.DateTime,
                              nullable=False,
                              server_default='1900-01-01 00:00:00')
    modification_date = db.Column(db.DateTime,
                                  nullable=False,
                                  server_default='1900-01-01 00:00:00')
    number_of_requests = db.Column(db.Integer(3, unsigned=True),
                                   nullable=False,
                                   server_default='0')
Esempio n. 13
0
class AccAuthorization(db.Model):
    """Represents a AccAssociation record."""
    __tablename__ = 'accROLE_accACTION_accARGUMENT'
    id_accROLE = db.Column(db.Integer(15, unsigned=True),
                           db.ForeignKey(AccROLE.id),
                           nullable=True,
                           autoincrement=False,
                           primary_key=True,
                           index=True)
    id_accACTION = db.Column(db.Integer(15, unsigned=True),
                             db.ForeignKey(AccACTION.id),
                             nullable=True,
                             autoincrement=False,
                             primary_key=True,
                             index=True)
    id_accARGUMENT = db.Column(
        db.Integer(15),  # , unsigned=True),
        db.ForeignKey(AccARGUMENT.id),
        nullable=True,
        primary_key=True,
        autoincrement=False,
        index=True)
    argumentlistid = db.Column(db.MediumInteger(8),
                               nullable=True,
                               autoincrement=False,
                               primary_key=True)
    role = db.relationship(AccROLE, backref='authorizations')
    action = db.relationship(AccACTION, backref='authorizations')
    argument = db.relationship(AccARGUMENT, backref='authorizations')
Esempio n. 14
0
class RnkMETHODDATA(db.Model):
    """Represents a RnkMETHODDATA record."""
    __tablename__ = 'rnkMETHODDATA'
    id_rnkMETHOD = db.Column(db.MediumInteger(9, unsigned=True),
                             db.ForeignKey(RnkMETHOD.id),
                             primary_key=True)
    relevance_data = db.Column(db.iLargeBinary, nullable=True)
Esempio n. 15
0
class CollectionRnkMETHOD(db.Model):
    """Represents a CollectionRnkMETHOD record."""
    __tablename__ = 'collection_rnkMETHOD'
    id_collection = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(Collection.id),
                              primary_key=True,
                              nullable=False)
    id_rnkMETHOD = db.Column(db.MediumInteger(9, unsigned=True),
                             db.ForeignKey(RnkMETHOD.id),
                             primary_key=True,
                             nullable=False)
    score = db.Column(db.TinyInteger(4, unsigned=True),
                      nullable=False,
                      server_default='0')
    collection = db.relationship(Collection, backref='rnkMETHODs')
    rnkMETHOD = db.relationship(RnkMETHOD, backref='collections')
Esempio n. 16
0
class OaiREPOSITORY(db.Model):
    """Represents a OaiREPOSITORY record."""
    __tablename__ = 'oaiREPOSITORY'
    id = db.Column(db.MediumInteger(9, unsigned=True),
                   nullable=False,
                   primary_key=True,
                   autoincrement=True)
    setName = db.Column(db.String(255), nullable=False, server_default='')
    setSpec = db.Column(db.String(255), nullable=False, server_default='')
    setCollection = db.Column(db.String(255),
                              nullable=False,
                              server_default='')
    setDescription = db.Column(db.Text, nullable=False)
    setDefinition = db.Column(db.Text, nullable=False)
    setRecList = db.Column(db.iLargeBinary, nullable=True)
    last_updated = db.Column(db.DateTime,
                             nullable=False,
                             server_default='1970-01-01 00:00:00')
    p1 = db.Column(db.Text, nullable=False)
    f1 = db.Column(db.Text, nullable=False)
    m1 = db.Column(db.Text, nullable=False)
    p2 = db.Column(db.Text, nullable=False)
    f2 = db.Column(db.Text, nullable=False)
    m2 = db.Column(db.Text, nullable=False)
    p3 = db.Column(db.Text, nullable=False)
    f3 = db.Column(db.Text, nullable=False)
    m3 = db.Column(db.Text, nullable=False)
Esempio n. 17
0
class CmtSUBSCRIPTION(db.Model):
    """Represents a CmtSUBSCRIPTION record."""
    __tablename__ = 'cmtSUBSCRIPTION'

    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False,
                          primary_key=True)
    id_user = db.Column(db.Integer(15, unsigned=True),
                        db.ForeignKey(User.id),
                        nullable=False,
                        primary_key=True)
    creation_time = db.Column(db.DateTime,
                              nullable=False,
                              server_default='1900-01-01 00:00:00')

    bibrec = db.relationship(Bibrec)
    user = db.relationship(User, backref='comment_subscriptions')
    user_commented_records = db.relationship(
        Bibrec,
        backref='user_comment_subscritions',
        primaryjoin=lambda: db.and_(
            CmtSUBSCRIPTION.id_bibrec == Bibrec.id, CmtSUBSCRIPTION.id_user ==
            current_user.get_id()),
        viewonly=True)
Esempio n. 18
0
class Collection_bsrMETHOD(db.Model):
    """Represents a Collection_bsrMETHOD record."""
    __tablename__ = 'collection_bsrMETHOD'

    id_collection = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(Collection.id),
                              primary_key=True,
                              nullable=False,
                              autoincrement=False)
    id_bsrMETHOD = db.Column(db.MediumInteger(9, unsigned=True),
                             db.ForeignKey(BsrMETHOD.id),
                             primary_key=True,
                             nullable=False,
                             autoincrement=False)
    score = db.Column(db.TinyInteger(4, unsigned=True),
                      server_default='0',
                      nullable=False)
Esempio n. 19
0
class Example(db.Model):
    """Represents a Example record."""
    __tablename__ = 'example'
    id = db.Column(db.MediumInteger(9, unsigned=True),
                   primary_key=True,
                   autoincrement=True)
    type = db.Column(db.Text, nullable=False)
    body = db.Column(db.Text, nullable=False)
Esempio n. 20
0
class KnwKBDDEF(db.Model):
    """Represents a KnwKBDDEF record."""
    def __init__(self):
        pass

    __tablename__ = 'knwKBDDEF'
    id_knwKB = db.Column(db.MediumInteger(8, unsigned=True),
                         db.ForeignKey(KnwKB.id),
                         nullable=False,
                         primary_key=True)
    id_collection = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(Collection.id),
                              nullable=True)
    output_tag = db.Column(db.Text, nullable=True)
    search_expression = db.Column(db.Text, nullable=True)
    kb = db.relationship(KnwKB, backref='kbdefs')
    collection = db.relationship(Collection, backref='kbdefs')
Esempio n. 21
0
class Portalbox(db.Model):
    """Represents a Portalbox record."""
    __tablename__ = 'portalbox'
    id = db.Column(db.MediumInteger(9, unsigned=True),
                   autoincrement=True,
                   primary_key=True)
    title = db.Column(db.Text, nullable=False)
    body = db.Column(db.Text, nullable=False)
Esempio n. 22
0
class RnkRECORDSCACHE(db.Model):
    """Represents a RnkRECORDSCACHE record."""
    __tablename__ = 'rnkRECORDSCACHE'
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=True,
                          primary_key=True)
    authorid = db.Column(db.BigInteger(10), primary_key=True, nullable=False)
Esempio n. 23
0
class AutocompletionCache(db.Model):
    """Stores the pre-calculated most popular authors and subjects for each collection"""
    __tablename__ = 'autocompletion_cache'
    id_collection = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(Collection.id),
                              primary_key=True,
                              nullable=False)
    subjects = db.Column(db.PickleType())
    authors = db.Column(db.PickleType())
Esempio n. 24
0
class RnkWORD01F(db.Model):
    """Represents a RnkWORD01F record."""
    __tablename__ = 'rnkWORD01F'
    id = db.Column(db.MediumInteger(9, unsigned=True),
                   nullable=False,
                   primary_key=True,
                   autoincrement=True)
    term = db.Column(db.String(50), nullable=True, unique=True)
    hitlist = db.Column(db.iLargeBinary, nullable=True)
Esempio n. 25
0
class CollectionFormat(db.Model):
    """Represents a CollectionFormat record."""
    __tablename__ = 'collection_format'
    id_collection = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(Collection.id),
                              primary_key=True)
    id_format = db.Column(db.MediumInteger(9, unsigned=True),
                          db.ForeignKey(Format.id),
                          primary_key=True)
    score = db.Column(db.TinyInteger(4, unsigned=True),
                      nullable=False,
                      server_default='0')
    collection = db.relationship(Collection,
                                 backref='formats',
                                 order_by=db.desc(score))
    format = db.relationship(Format,
                             backref='collections',
                             order_by=db.desc(score))
Esempio n. 26
0
class RnkCITATIONDATA(db.Model):
    """Represents a RnkCITATIONDATA record."""
    __tablename__ = 'rnkCITATIONDATA'
    id = db.Column(db.MediumInteger(8, unsigned=True), primary_key=True)
    object_name = db.Column(db.String(20), unique=True, nullable=False)
    object_value = db.Column(db.iLargeBinary, nullable=True)
    last_updated = db.Column(db.DateTime,
                             nullable=False,
                             server_default='1900-01-01 00:00:00')
Esempio n. 27
0
class Bibdocmoreinfo(db.Model):
    """Represents a Bibdocmoreinfo record."""
    __tablename__ = 'bibdocmoreinfo'

    id = db.Column(db.MediumInteger(9, unsigned=True), primary_key=True)
    id_bibdoc = db.Column(db.MediumInteger(9, unsigned=True),
                          db.ForeignKey(Bibdoc.id),
                          nullable=True)
    version = db.Column(db.TinyInteger(4, unsigned=True), nullable=True)
    format = db.Column(db.String(50), nullable=True)
    id_rel = db.Column(db.MediumInteger(9, unsigned=True), nullable=True)
    namespace = db.Column(db.Char(25), nullable=True)
    data_key = db.Column(db.Char(25))
    data_value = db.Column(db.LargeBinary)

    __table_args__ = (db.Index('bibdocmoreinfo_key', id_bibdoc, version,
                               format, id_rel, namespace,
                               data_key), db.Model.__table_args__)
Esempio n. 28
0
class Collectiondetailedrecordpagetabs(db.Model):
    """Represents a Collectiondetailedrecordpagetabs record."""
    __tablename__ = 'collectiondetailedrecordpagetabs'
    id_collection = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(Collection.id),
                              nullable=False,
                              primary_key=True)
    tabs = db.Column(db.String(255), nullable=False, server_default='')
    collection = db.relationship(Collection,
                                 backref='collectiondetailedrecordpagetabs')
Esempio n. 29
0
class BsrMETHOD(db.Model):
    """Represents a BsrMETHOD record."""
    __tablename__ = 'bsrMETHOD'

    id = db.Column(db.MediumInteger(9, unsigned=True),
                   primary_key=True,
                   nullable=False)
    name = db.Column(db.String(20), nullable=False, unique=True)
    definition = db.Column(db.String(255), nullable=False)
    washer = db.Column(db.String(255), nullable=False)
Esempio n. 30
0
class Fieldname(db.Model):
    """Represents a Fieldname record."""
    __tablename__ = 'fieldname'
    id_field = db.Column(db.MediumInteger(9, unsigned=True),
                         db.ForeignKey(Field.id),
                         primary_key=True)
    ln = db.Column(db.Char(5), primary_key=True, server_default='')
    type = db.Column(db.Char(3), primary_key=True, server_default='sn')
    value = db.Column(db.String(255), nullable=False)
    field = db.relationship(Field, backref='names')