Beispiel #1
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)
Beispiel #2
0
class CrcLOAN(db.Model):
    """Represents a CrcLOAN record."""
    def __init__(self):
        pass

    __tablename__ = 'crcLOAN'
    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='')
    loaned_on = db.Column(db.DateTime,
                          nullable=False,
                          server_default='1900-01-01 00:00:00')
    returned_on = db.Column(db.Date,
                            nullable=False,
                            server_default='0000-00-00')
    due_date = db.Column(db.DateTime,
                         nullable=False,
                         server_default='1900-01-01 00:00:00')
    number_of_renewals = db.Column(db.Integer(3, unsigned=True),
                                   nullable=False,
                                   server_default='0')
    overdue_letter_number = db.Column(db.Integer(3, unsigned=True),
                                      nullable=False,
                                      server_default='0')
    overdue_letter_date = db.Column(db.DateTime,
                                    nullable=False,
                                    server_default='1900-01-01 00:00:00')
    status = db.Column(db.String(20), nullable=False, server_default='')
    type = db.Column(db.String(20), nullable=False, server_default='')
    notes = db.Column(db.Text, nullable=True)
    borrower = db.relationship(CrcBORROWER, backref='loans')
    bibrec = db.relationship(Bibrec, backref='loans')
    item = db.relationship(CrcITEM, backref='loans')
Beispiel #3
0
class WtgTAGRecord(db.Model, Serializable):
    """ Represents a connection between Tag and Record """

    __tablename__ = 'wtgTAG_bibrec'
    __public__ = ['id_tag', 'id_bibrec', 'date_added']

    # tagTAG.id
    id_tag = db.Column(db.Integer(15, unsigned=True),
                       db.ForeignKey(WtgTAG.id),
                       nullable=False,
                       primary_key=True)

    # Bibrec.id
    id_bibrec = db.Column(db.Integer(15, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False,
                          primary_key=True)

    # Creation date
    date_added = db.Column(db.DateTime, default=datetime.now)

    # Relationships
    tag = db.relationship(WtgTAG,
                          backref=db.backref('records_association',
                                             cascade='all'))

    tag_query = db.relationship(WtgTAG,
                                backref=db.backref('records_association_query',
                                                   cascade='all',
                                                   lazy='dynamic'))

    bibrec = db.relationship(Bibrec,
                             backref=db.backref('tags_association',
                                                cascade='all'))

    bibrec_query = db.relationship(Bibrec,
                                   backref=db.backref('tags_association_query',
                                                      cascade='all',
                                                      lazy='dynamic'))

    # Constructor
    def __init__(self, bibrec=None, **kwargs):
        super(WtgTAGRecord, self).__init__(**kwargs)

        self.bibrec = bibrec
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())
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))
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')
Beispiel #7
0
class RnkSELFCITES(db.Model):
    """Represents a RnkSELFCITES record."""
    __tablename__ = 'rnkSELFCITES'
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=True,
                          primary_key=True)
    count = db.Column(db.Integer(10, unsigned=True), nullable=False)
    references = db.Column(db.Text, nullable=False)
    last_updated = db.Column(db.DateTime, nullable=False)
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')
class RnkMETHODNAME(db.Model):
    """Represents a RnkMETHODNAME record."""
    __tablename__ = 'rnkMETHODNAME'
    id_rnkMETHOD = db.Column(db.MediumInteger(9, unsigned=True),
                             db.ForeignKey(RnkMETHOD.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)
    method = db.relationship(RnkMETHOD, backref='names')
class UserMsgMESSAGE(db.Model):
    """Represents a UserMsgMESSAGE record."""
    __tablename__ = 'user_msgMESSAGE'
    id_user_to = db.Column(db.Integer(15, unsigned=True),
                           db.ForeignKey(User.id),
                           nullable=False,
                           server_default='0',
                           primary_key=True)
    id_msgMESSAGE = db.Column(db.Integer(15, unsigned=True),
                              db.ForeignKey(MsgMESSAGE.id),
                              nullable=False,
                              server_default='0',
                              primary_key=True)
    status = db.Column(db.Char(1), nullable=False, server_default='N')
    user_to = db.relationship(User,
                              backref='received_messages',
                              collection_class=set)
    message = db.relationship(MsgMESSAGE,
                              backref='sent_to_users',
                              collection_class=set)
class UsergroupBskBASKET(db.Model):
    """Represents a UsergroupBskBASKET record."""
    __tablename__ = 'usergroup_bskBASKET'
    id_usergroup = db.Column(db.Integer(15, unsigned=True),
                             db.ForeignKey(Usergroup.id),
                             nullable=False,
                             server_default='0',
                             primary_key=True)
    id_bskBASKET = db.Column(db.Integer(15, unsigned=True),
                             db.ForeignKey(BskBASKET.id),
                             nullable=False,
                             server_default='0',
                             primary_key=True)
    topic = db.Column(db.String(50), nullable=False, server_default='')
    date_shared = db.Column(db.DateTime,
                            nullable=False,
                            server_default='1900-01-01 00:00:00')
    share_level = db.Column(db.Char(2), nullable=False, server_default='')
    usergroup = db.relationship(Usergroup, backref='usergroup_baskets')
    usergroup_basket = db.relationship(BskBASKET, backref='usergroups')
class LnkLOG(db.Model):
    """Represents a LnkLOG record."""
    __tablename__ = 'lnkLOG'

    id = db.Column(db.Integer(15, unsigned=True),
                   primary_key=True,
                   nullable=False)
    id_user = db.Column(db.Integer(15, unsigned=True), db.ForeignKey(User.id))
    action = db.Column(db.String(30), nullable=False, index=True)
    log_time = db.Column(db.DateTime,
                         server_default='1900-01-01 00:00:00',
                         index=True)
Beispiel #13
0
class BsrMETHODNAME(db.Model):
    """Represents a BsrMETHODNAME record."""
    __tablename__ = 'bsrMETHODNAME'

    id_bsrMETHOD = db.Column(db.MediumInteger(9, unsigned=True),
                             db.ForeignKey(BsrMETHOD.id),
                             primary_key=True,
                             nullable=False,
                             autoincrement=False)
    ln = db.Column(db.String(5), primary_key=True, nullable=False)
    type = db.Column(db.String(3), primary_key=True, nullable=False)
    value = db.Column(db.String(255), nullable=False)
Beispiel #14
0
class RnkPAGEVIEWS(db.Model):
    """Represents a RnkPAGEVIEWS record."""
    __tablename__ = 'rnkPAGEVIEWS'
    id = db.Column(db.MediumInteger,
                   primary_key=True,
                   nullable=False,
                   autoincrement=True)
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=True,
                          primary_key=True)
    id_user = db.Column(db.Integer(15, unsigned=True),
                        db.ForeignKey(User.id),
                        server_default='0',
                        primary_key=True)
    client_host = db.Column(db.Integer(10, unsigned=True), nullable=True)
    view_time = db.Column(db.DateTime,
                          primary_key=True,
                          server_default='1900-01-01 00:00:00')
    bibrec = db.relationship(Bibrec, backref='pageviews')
    user = db.relationship(User, backref='pageviews')
Beispiel #15
0
class BsrMETHODDATA(db.Model):
    """Represents a BsrMETHODDATA record."""
    __tablename__ = 'bsrMETHODDATA'

    id_bsrMETHOD = db.Column(db.MediumInteger(9, unsigned=True),
                             db.ForeignKey(BsrMETHOD.id),
                             primary_key=True,
                             nullable=False,
                             autoincrement=False)
    data_dict = db.Column(db.LargeBinary)
    data_dict_ordered = db.Column(db.LargeBinary)
    data_list_sorted = db.Column(db.LargeBinary)
    last_updated = db.Column(db.DateTime)
def do_upgrade():
    """ Implement your upgrades here  """
    m = db.MetaData(bind=db.engine)
    m.reflect()
    t = db.Table(
        'userCOLLECTION',
        m,
        db.Column('id', db.String(length=100), primary_key=True, nullable=False),
        db.Column('id_user', db.Integer(15, unsigned=True), db.ForeignKey('user.id'), nullable=False),
        db.Column('id_collection', db.MediumInteger(9, unsigned=True), db.ForeignKey('collection.id'), nullable=True),
        db.Column('id_collection_provisional', db.MediumInteger(9, unsigned=True), db.ForeignKey('collection.id'), nullable=True),
        db.Column('id_oairepository', db.MediumInteger(9, unsigned=True), db.ForeignKey('oaiREPOSITORY.id'), nullable=True),
        db.Column('title', db.String(length=255), nullable=False),
        db.Column('description', db.Text(), nullable=False),
        db.Column('page', db.Text(), nullable=False),
        db.Column('curation_policy', db.Text(), nullable=False),
        db.Column('has_logo', db.Boolean(), nullable=False),
        db.Column('created', db.DateTime(), nullable=False),
        db.Column('last_modified', db.DateTime(), nullable=False),
        mysql_engine='MyISAM',
    )
    t.create()
Beispiel #17
0
class RnkWORD01R(db.Model):
    """Represents a RnkWORD01R record."""
    __tablename__ = 'rnkWORD01R'
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False,
                          primary_key=True)
    termlist = db.Column(db.LargeBinary, nullable=True)
    type = db.Column(db.Enum('CURRENT', 'FUTURE', 'TEMPORARY'),
                     nullable=False,
                     server_default='CURRENT',
                     primary_key=True)
    bibrec = db.relationship(Bibrec, backref='word01rs')
Beispiel #18
0
class RnkCITATIONDATAEXT(db.Model):
    """Represents a RnkCITATIONDATAEXT record."""
    __tablename__ = 'rnkCITATIONDATAEXT'
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          autoincrement=False,
                          primary_key=True,
                          nullable=False,
                          server_default='0')
    extcitepubinfo = db.Column(db.String(255),
                               primary_key=True,
                               nullable=False,
                               index=True)
class HstBATCHUPLOAD(db.Model):
    """Represents a HstBATCHUPLOAD record."""
    __tablename__ = 'hstBATCHUPLOAD'
    id = db.Column(db.Integer(15, unsigned=True), nullable=False,
                primary_key=True, autoincrement=True)
    user = db.Column(db.String(50), nullable=False, index=True)
    submitdate = db.Column(db.DateTime, nullable=False)
    filename = db.Column(db.String(255), nullable=False)
    execdate = db.Column(db.DateTime, nullable=False)
    id_schTASK = db.Column(db.Integer(15, unsigned=True),
                db.ForeignKey(SchTASK.id), nullable=False)
    batch_mode = db.Column(db.String(15), nullable=False)
    task = db.relationship(SchTASK, backref='batchuploads')
Beispiel #20
0
class UserQueryBasket(db.Model):
    """Represents a UserQueryBasket record."""
    __tablename__ = 'user_query_basket'
    id_user = db.Column(db.Integer(15, unsigned=True),
                        db.ForeignKey(User.id),
                        nullable=False,
                        server_default='0',
                        primary_key=True)
    id_query = db.Column(db.Integer(15, unsigned=True),
                         db.ForeignKey(WebQuery.id),
                         nullable=False,
                         server_default='0',
                         primary_key=True,
                         index=True)
    id_basket = db.Column(db.Integer(15, unsigned=True),
                          db.ForeignKey(BskBASKET.id),
                          nullable=False,
                          server_default='0',
                          primary_key=True,
                          index=True)
    frequency = db.Column(db.String(5),
                          nullable=False,
                          server_default='',
                          primary_key=True)
    date_creation = db.Column(db.Date, nullable=True)
    date_lastrun = db.Column(db.Date,
                             nullable=True,
                             server_default='1900-01-01')
    alert_name = db.Column(db.String(30),
                           nullable=False,
                           server_default='',
                           index=True)
    alert_desc = db.Column(db.Text)
    alert_recipient = db.Column(db.Text)
    notification = db.Column(db.Char(1), nullable=False, server_default='y')
    user = db.relationship(User, backref='query_baskets')
    webquery = db.relationship(WebQuery, backref='user_baskets')
    basket = db.relationship(BskBASKET, backref='user_queries')
Beispiel #21
0
class CmtACTIONHISTORY(db.Model):
    """Represents a CmtACTIONHISTORY record."""
    __tablename__ = 'cmtACTIONHISTORY'
    id_cmtRECORDCOMMENT = db.Column(db.Integer(15, unsigned=True),
                                    db.ForeignKey(CmtRECORDCOMMENT.id),
                                    nullable=True,
                                    primary_key=True)
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=True,
                          primary_key=True)
    id_user = db.Column(db.Integer(15, unsigned=True),
                        db.ForeignKey(User.id),
                        nullable=True,
                        primary_key=True)
    client_host = db.Column(db.Integer(10, unsigned=True), nullable=True)
    action_time = db.Column(db.DateTime,
                            nullable=False,
                            server_default='1900-01-01 00:00:00')
    action_code = db.Column(db.Char(1), nullable=False, index=True)
    recordcomment = db.relationship(CmtRECORDCOMMENT, backref='actionhistory')
    bibrec = db.relationship(Bibrec)
    user = db.relationship(User)
class CollectionPortalbox(db.Model):
    """Represents a CollectionPortalbox record."""
    __tablename__ = 'collection_portalbox'
    id_collection = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(Collection.id),
                              primary_key=True)
    id_portalbox = db.Column(db.MediumInteger(9, unsigned=True),
                             db.ForeignKey(Portalbox.id),
                             primary_key=True)
    ln = db.Column(db.Char(5),
                   primary_key=True,
                   server_default='',
                   nullable=False)
    position = db.Column(db.Char(3), nullable=False, server_default='top')
    score = db.Column(db.TinyInteger(4, unsigned=True),
                      nullable=False,
                      server_default='0')
    collection = db.relationship(Collection,
                                 backref='portalboxes',
                                 order_by=score)
    portalbox = db.relationship(Portalbox,
                                backref='collections',
                                order_by=score)
class CollectionCollection(db.Model):
    """Represents a CollectionCollection record."""
    __tablename__ = 'collection_collection'
    id_dad = db.Column(db.MediumInteger(9, unsigned=True),
                       db.ForeignKey(Collection.id),
                       primary_key=True)
    id_son = db.Column(db.MediumInteger(9, unsigned=True),
                       db.ForeignKey(Collection.id),
                       primary_key=True)
    type = db.Column(db.Char(1), nullable=False, server_default='r')
    score = db.Column(db.TinyInteger(4, unsigned=True),
                      nullable=False,
                      server_default='0')
    son = db.relationship(
        Collection,
        primaryjoin=id_son == Collection.id,
        backref='dads',
        #FIX collection_class=db.attribute_mapped_collection('score'),
        order_by=db.asc(score))
    dad = db.relationship(Collection,
                          primaryjoin=id_dad == Collection.id,
                          backref='sons',
                          order_by=db.asc(score))
Beispiel #24
0
class WebDepositDraft(db.Model):
    """Represents a deposition draft."""
    __tablename__ = 'depDRAFT'
    uuid = db.Column(db.String(36),
                     db.ForeignKey(Workflow.uuid),
                     primary_key=True)
    step = db.Column(db.Integer(15, unsigned=True),
                     primary_key=True,
                     autoincrement=False)
    form_type = db.Column(db.String(45), nullable=False)
    form_values = db.Column(db.JSON, nullable=False)
    status = db.Column(db.Integer(15, unsigned=True), autoincrement=False)
    timestamp = db.Column(db.DateTime, nullable=False)
    workflow = db.relationship(Workflow, backref='drafts')
Beispiel #25
0
class WtgTAGUsergroup(db.Model, Serializable):
    """ Represents access rights of the group concerning the tag """

    __tablename__ = 'wtgTAG_usergroup'
    __public__ = ['id_tag', 'id_usergroup', 'group_access_rights']

    # tagTAG.id
    id_tag = db.Column(db.Integer(15, unsigned=True),
                       db.ForeignKey(WtgTAG.id),
                       nullable=False,
                       primary_key=True)

    # usergroup.id
    id_usergroup = id_usergroup = db.Column(db.Integer(15, unsigned=True),
                                            db.ForeignKey(Usergroup.id),
                                            nullable=False,
                                            server_default='0',
                                            primary_key=True)

    # Access rights
    group_access_rights = db.Column(db.Integer(2, unsigned=True),
                                    nullable=False,
                                    default=CFG_WEBTAG_ACCESS_LEVELS['View'])

    # Relationships
    tag = db.relationship(WtgTAG,
                          backref=db.backref('group_rights', cascade='all'))

    group = db.relationship(Usergroup,
                            backref=db.backref('tag_rights', cascade='all'))

    # Validation
    @db.validates('group_access_rights')
    def validate_user_access_rights(self, key, value):
        """ Check if the value is among defined levels """
        assert value in CFG_WEBTAG_ACCESS_NAMES
        return value
class BskRECORDCOMMENT(db.Model):
    """Represents a BskRECORDCOMMENT record."""
    __tablename__ = 'bskRECORDCOMMENT'
    id = db.Column(db.Integer(15, unsigned=True),
                   nullable=False,
                   primary_key=True,
                   autoincrement=True)
    id_bibrec_or_bskEXTREC = db.Column(db.Integer(16),
                                       nullable=False,
                                       server_default='0')
    id_bskBASKET = db.Column(db.Integer(15, unsigned=True),
                             db.ForeignKey(BskBASKET.id),
                             nullable=False,
                             server_default='0')
    id_user = db.Column(db.Integer(15, unsigned=True),
                        db.ForeignKey(User.id),
                        nullable=False,
                        server_default='0')
    title = db.Column(db.String(255), nullable=False, server_default='')
    body = db.Column(db.Text, nullable=False)
    date_creation = db.Column(db.DateTime,
                              nullable=False,
                              server_default='1900-01-01 00:00:00',
                              index=True)
    priority = db.Column(db.Integer(15), nullable=False, server_default='0')
    in_reply_to_id_bskRECORDCOMMENT = db.Column(db.Integer(15, unsigned=True),
                                                db.ForeignKey(id),
                                                nullable=False,
                                                server_default='0')
    reply_order_cached_data = db.Column(db.Binary, nullable=True)
    in_reply_to = db.relationship('BskRECORDCOMMENT')
    basket = db.relationship(BskBASKET, backref='RECORDCOMMENTs')
    user = db.relationship(User)

    __table_args__ = (db.Index('bskRECORDCOMMENT_reply_order_cached_data',
                               reply_order_cached_data,
                               mysql_length=[40]), db.Model.__table_args__)
Beispiel #27
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')
Beispiel #28
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 JrnISSUE(db.Model):
    """Represents a JrnISSUE record."""
    __tablename__ = 'jrnISSUE'
    id_jrnJOURNAL = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(JrnJOURNAL.id),
                              nullable=False,
                              primary_key=True)
    issue_number = db.Column(db.String(50),
                             nullable=False,
                             server_default='',
                             primary_key=True)
    issue_display = db.Column(db.String(50), nullable=False, server_default='')
    date_released = db.Column(db.DateTime, nullable=True)
    date_announced = db.Column(db.DateTime, nullable=True)
    journal = db.relationship(JrnJOURNAL, backref='issues')