Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# -*- coding: utf-8 -*-
3"""
4 (c) 2019 - Copyright Red Hat Inc
6 Authors:
7 Pierre-Yves Chibon <pingou@pingoured.fr>
9"""
11from __future__ import print_function, unicode_literals
13import logging
15from pagure.lib.model import Project
16from pagure.lib.model_base import BASE
18import sqlalchemy as sa
19from sqlalchemy.orm import backref, relation
21_log = logging.getLogger(__name__)
24# DB Model
27class PagureAnitya(BASE):
28 """Stores information about the monitoring of a project in anitya.
30 Table -- pagure_anitya
31 """
33 __tablename__ = "pagure_anitya"
35 id = sa.Column(sa.Integer, primary_key=True)
36 project_id = sa.Column(
37 sa.Integer,
38 sa.ForeignKey("projects.id", onupdate="CASCADE", ondelete="CASCADE"),
39 nullable=False,
40 unique=True,
41 index=True,
42 )
44 anitya_status = sa.Column(
45 sa.String(255), nullable=False, unique=False, default="no-monitoring"
46 )
48 project = relation(
49 "Project",
50 remote_side=[Project.id],
51 backref=backref(
52 "anitya",
53 cascade="delete, delete-orphan",
54 single_parent=True,
55 uselist=False,
56 ),
57 )
60class PagureOrphanReason(BASE):
61 """Stores information about the orphaning reason.
63 Table -- pagure_orphan_reason
65 Attributes:
66 project_id: Id of orphaned project
67 reason: Reason for orphaning
68 reason: Any additional info for orphaning
69 """
71 __tablename__ = "pagure_orphan_reason"
73 id = sa.Column(sa.Integer, primary_key=True)
74 project_id = sa.Column(
75 sa.Integer,
76 sa.ForeignKey("projects.id", onupdate="CASCADE", ondelete="CASCADE"),
77 nullable=False,
78 unique=True,
79 index=True,
80 )
82 reason = sa.Column(sa.String(255), nullable=True, unique=False)
84 reason_info = sa.Column(sa.String(255), nullable=True, unique=False)
86 project = relation(
87 "Project",
88 remote_side=[Project.id],
89 backref=backref(
90 "orphan_reason",
91 cascade="delete, delete-orphan",
92 single_parent=True,
93 uselist=False,
94 ),
95 )
98class PagureBZOverride(BASE):
99 """Stores information about default assignees (Fedora vs. EPEL)
101 Table -- pagure_bzoverride
102 """
104 __tablename__ = "pagure_bzoverride"
106 id = sa.Column(sa.Integer, primary_key=True)
107 project_id = sa.Column(
108 sa.Integer,
109 sa.ForeignKey("projects.id", onupdate="CASCADE", ondelete="CASCADE"),
110 nullable=False,
111 unique=True,
112 index=True,
113 )
115 epel_assignee = sa.Column(sa.String(255), unique=False, nullable=True)
116 fedora_assignee = sa.Column(sa.String(255), unique=False, nullable=True)
118 project = relation(
119 "Project",
120 remote_side=[Project.id],
121 backref=backref(
122 "bzoverride",
123 cascade="delete, delete-orphan",
124 single_parent=True,
125 uselist=False,
126 ),
127 )