class Questionnaire(db.Model): __tablename__ = 'questionnaire' id = db.Column(UUID(as_uuid=True), primary_key=True) project_id = db.Column(db.ForeignKey('project.id')) user_filler = db.Column(db.ForeignKey('user.id')) to_date = db.Column(db.DateTime) is_transition_completed = db.Column(db.Integer) is_transition_charges_paied = db.Column(db.Integer) is_transformation_completed = db.Column(db.Integer) missed_kpi = db.Column(db.Integer) missed_service_level = db.Column(db.Integer) moved_service_level = db.Column(db.Integer) payable_service_credits = db.Column(db.Numeric) paied_service_credits = db.Column(db.Numeric) is_paied_passed = db.Column(db.Integer) pay_back = db.Column(db.Numeric) is_customer_satisfaction_report = db.Column(db.Integer) customer_satisfaction_result = db.Column(db.Integer) is_additional_governance = db.Column(db.Integer) additional_governance_cause = db.Column(db.Integer) initiated_CCNs = db.Column(db.Integer) signed_CCNs = db.Column(db.Integer) signed_CCNs_type = db.Column(db.Integer) key_personnel_changed = db.Column(db.Integer) supplier_personnel_changed = db.Column(db.Integer) customer_personnel_changed = db.Column(db.Integer) service_level_missed_target = db.Column(db.Integer) service_level_missed_target_value = db.Column(db.Integer) service_level_missed_target_max = db.Column(db.Integer) costs_incurred = db.Column(db.Numeric) CREATED_BY = db.Column(db.Integer) UPDATED_BY = db.Column(db.Integer) UPDATED_AT = db.Column(db.DateTime, server_default=db.func.now()) CREATED_AT = db.Column(db.DateTime, server_default=db.func.now(), server_onupdate=db.func.now()) project = db.relationship('Project') user = db.relationship('User')
class Bespoke(db.Model): __tablename__ = 'bespoke' id = db.Column(db.Integer, primary_key=True) type = db.Column(db.Integer) project_id = db.Column(db.ForeignKey('project.id')) CREATED_BY = db.Column(db.Integer) UPDATED_BY = db.Column(db.Integer) UPDATED_AT = db.Column(db.DateTime, server_default=db.func.now()) CREATED_AT = db.Column( db.DateTime, server_default=db.func.now(), server_onupdate=db.func.now()) project = db.relationship('Project')
class ContractValue(db.Model): __tablename__ = 'contract_value' id = db.Column(db.Integer, primary_key=True) year = db.Column(db.Integer) contract_value_usd = db.Column(db.Numeric) project_id = db.Column(db.ForeignKey('project.id')) estimated_cost_usd = db.Column(db.Numeric) CREATED_BY = db.Column(db.Integer) UPDATED_BY = db.Column(db.Integer) UPDATED_AT = db.Column(db.DateTime, server_default=db.func.now()) CREATED_AT = db.Column(db.DateTime, server_default=db.func.now(), server_onupdate=db.func.now()) project = db.relationship('Project')
class Dispute(db.Model): __tablename__ = 'dispute' id = db.Column(UUID(as_uuid=True), primary_key=True) subject = db.Column(db.Integer) questionnaire_id = db.Column(db.ForeignKey('questionnaire.id')) CREATED_BY = db.Column(db.Integer) UPDATED_BY = db.Column(db.Integer) UPDATED_AT = db.Column(db.DateTime, server_default=db.func.now()) CREATED_AT = db.Column(db.DateTime, server_default=db.func.now(), server_onupdate=db.func.now()) questionnaire = db.relationship('Questionnaire')
class Governance(db.Model): __tablename__ = 'governance' id = db.Column(UUID(as_uuid=True), primary_key=True) type = db.Column(db.Integer) how_often = db.Column(db.Integer) project_id = db.Column(db.ForeignKey('project.id')) CREATED_BY = db.Column(db.Integer) UPDATED_BY = db.Column(db.Integer) UPDATED_AT = db.Column(db.DateTime, server_default=db.func.now()) CREATED_AT = db.Column(db.DateTime, server_default=db.func.now(), server_onupdate=db.func.now()) project = db.relationship('Project')
class Charge(db.Model): __tablename__ = 'charges' id = db.Column(UUID(as_uuid=True), primary_key=True) invoiced_charges = db.Column(db.Integer) questionnaire_id = db.Column(db.ForeignKey('questionnaire.id')) invoice_date = db.Column(db.DateTime) amount = db.Column(db.Numeric) CREATED_BY = db.Column(db.Integer) UPDATED_BY = db.Column(db.Integer) UPDATED_AT = db.Column(db.DateTime, server_default=db.func.now()) CREATED_AT = db.Column(db.DateTime, server_default=db.func.now(), server_onupdate=db.func.now()) questionnaire = db.relationship('Questionnaire')
class Change(db.Model): __tablename__ = 'changes' id = db.Column(UUID(as_uuid=True), primary_key=True) subject = db.Column(db.Integer) questionnaire_id = db.Column(db.ForeignKey('questionnaire.id')) month_impact = db.Column(db.Integer) charges_impact = db.Column(db.Numeric) effective_date = db.Column(db.DateTime) CREATED_BY = db.Column(db.Integer) UPDATED_BY = db.Column(db.Integer) UPDATED_AT = db.Column(db.DateTime, server_default=db.func.now()) CREATED_AT = db.Column(db.DateTime, server_default=db.func.now(), server_onupdate=db.func.now()) questionnaire = db.relationship('Questionnaire')
class Milestone(db.Model): __tablename__ = 'milestone' id = db.Column(UUID(as_uuid=True), primary_key=True) type = db.Column(db.Integer) project_id = db.Column(db.ForeignKey('project.id')) is_payment = db.Column(db.Integer) completion_date = db.Column(db.DateTime) charges = db.Column(db.Numeric) is_paied = db.Column(db.Integer) CREATED_BY = db.Column(db.Integer) UPDATED_BY = db.Column(db.Integer) UPDATED_AT = db.Column(db.DateTime, server_default=db.func.now()) CREATED_AT = db.Column(db.DateTime, server_default=db.func.now(), server_onupdate=db.func.now()) project = db.relationship('Project')
from example_app.extensions import db from sqlalchemy import func from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy.ext.associationproxy import association_proxy user_role = db.Table( "user_role", db.metadata, db.Column("user_id", db.Integer, db.ForeignKey("user.id")), db.Column("role_id", db.Integer, db.ForeignKey("role.id")), db.UniqueConstraint("user_id", "role_id"), ) class User(db.Model): __tablename__ = "user" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(20)) password = db.Column(db.String(100), nullable=False) roles = db.relationship("Role", secondary=user_role, back_populates="users") role_names = key_ids = association_proxy("roles", "name") class Role(db.Model): __tablename__ = "role" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(255)) users = db.relationship("User", secondary=user_role, back_populates="roles")