class OrderDetails(db.Model, BaseModel): # table name __tablename__ = 'order_details' # displayed fields visible = ['id', 'ticket_id', 'order_id', 'count', 'price', 'created_at', 'updated_at'] # columns definitions id = db.Column(db.Integer, primary_key=True) ticket_id = db.Column( db.String(40), db.ForeignKey('tickets.id'), nullable=False ) ticket = db.relationship('Ticket') order_id = db.Column( db.String(180), db.ForeignKey('orders.id'), nullable=False ) order = db.relationship('Order') count = db.Column(db.Integer) price = db.Column(db.Integer) created_at = db.Column(db.DateTime) updated_at = db.Column(db.DateTime) def __init__(self): self.created_at = datetime.datetime.now() self.updated_at = datetime.datetime.now()
class Rate(Base): __tablename__ = 'up_rate' id = db.Column(db.Integer, primary_key=True) project_id = db.Column(db.Integer) project_name = db.Column(db.String(200)) user_id = db.Column(db.Integer) user_name = db.Column(db.String(200)) rate = db.Column(db.Float(scale=16, precision=2)) currency = db.Column(db.String(3)) @staticmethod def get_all_rates(): query = '''SELECT ur.id, ur.project_id, p.name AS project_name, ur.user_id, u.name AS user_name, ur.rate AS rate, ur.currency FROM up_rate ur LEFT JOIN user u ON ur.user_id = u.id LEFT JOIN project p ON ur.project_id = p.id WHERE ur.user_id IS NOT NULL;''' return Rate.query.from_statement(text(query)).all() def __repr__(self): return '<Rate %r>' % self.id
class Item(db.Model): id = db.Column(db.Integer, primary_key=True) registry = db.Column(db.String(32), unique=True, nullable=True) name = db.Column(db.String(120), nullable=False) description = db.Column(db.Text) available = db.Column(db.Boolean, nullable=False, default=True) category_id = db.Column(db.Integer, db.ForeignKey('category.id', onupdate='CASCADE', ondelete='SET NULL'), nullable=True) lendings = db.relationship('Lending', backref='item', lazy=True) def to_dict(self): obj = { "id": self.id, "registry": self.registry, "name": self.name, "description": self.description, "available": self.available, "category_id": self.category_id } return obj def from_dict(self, data): for field in [ 'registry', 'name', 'description', 'category_id', 'available' ]: if field in data: setattr(self, field, data[field]) @staticmethod def check_data(data: dict, new: bool = False): error = utils.check_data(data, definition, new) return error
class User(db.Model, UserMixin): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) # User authentication information (required for Flask-User) email = db.Column(db.Unicode(255), nullable=False, server_default=u'', unique=True) username = db.Column(db.String(80), nullable=False, server_default='') # confirmed_at = db.Column(db.DateTime()) password = db.Column(db.String(255), nullable=False, server_default='') active = db.Column(db.Boolean(), nullable=False, server_default='0') # User information active = db.Column('is_active', db.Boolean(), nullable=False, server_default='0') # Relationships roles = db.relationship('Role', secondary='user_roles', backref=db.backref('users', lazy='dynamic')) def __repr__(self): return self.username
class Request(db.Model): # SCHEMA ID = db.Column(db.Integer, primary_key=True) timeStamp = db.Column(db.DateTime, index=True, default=datetime.utcnow) fromLocation = db.Column(db.String(128), index=True) toLocation = db.Column(db.String(128), index=True) # One REQUEST links to many RESPONSES responses = db.relationship('Response', backref='request', lazy='dynamic') # Save database changes def save(self): db.session.add(self) db.session.commit() # Delete database elements def delete(self): db.session.delete(self) db.session.commit() # Get element from table by ID @staticmethod def get(id): return Request.query.get(id) # Get all elements @staticmethod def get_all(): return Request.query.all() # String representation def __repr__(self): return '<Request {} from {} to {} at {}>'.format( self.ID, self.fromLocation, self.toLocation, self.toLocation)
class Thirdparty(db.Model): id = db.Column(db.Integer, primary_key=True) first_name = db.Column(db.String(120), nullable=False) last_name = db.Column(db.String(120), nullable=False) email = db.Column(db.String(120), unique=True, nullable=False) phone = db.Column(db.String(30)) reservations = db.relationship('Reservation', backref='thirdparty', lazy=True) lendings = db.relationship('Lending', backref='thirdparty', lazy=True) def to_dict(self): obj = { "id": self.id, "first_name": self.first_name, "last_name": self.last_name, "email": self.email, "phone": self.phone } return obj def from_dict(self, data): for field in ['first_name', 'last_name', 'email', 'phone']: if field in data: setattr(self, field, data[field]) @staticmethod def check_data(data: dict, new: bool = False): error = utils.check_data(data, definition, new) \ or utils.check_name(data, 'first_name') \ or utils.check_name(data, 'last_name') \ or utils.check_email(data, 'email') \ or utils.check_phone(data, 'phone') return error
class UserModel(db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(80), nullable=False, unique=True) name = db.Column(db.String(255), nullable=False) password = db.Column(db.String(80),nullable=False) def __init__(self, username, name, password): self.username = username self.name = name self.password = password def json(self): return { 'id': self.id, 'username': self.username, 'name': self.name } def save_to_db(self): db.session.add(self) db.session.commit() def delete_from_db(self): db.session.delete(self) db.session.commit() @classmethod def find_by_username(cls, username): return cls.query.filter_by(username=username).first() @classmethod def find_by_id(cls, _id): return cls.query.filter_by(id=_id).first()
class Post(AccessControlMixin, StatusMixin, CommentMixin, TagMixin, db.Model): """Implements the Post model. """ title = db.Column(db.String(32)) sub = db.Column(db.String(128)) user_id = db.Column(db.Integer, db.ForeignKey(u'user.id')) user = db.relationship('User', backref='posts', lazy='select') content = db.Column(db.Text()) def __init__(self, title, sub, user, content): """Initialize the Sketch object. Args: :param title: The title of the post :param sub: The subtitle of the post :param user: A user :param content: Content db.String """ super(Post, self).__init__() self.title = title self.sub = sub self.user = user self.content = content def __repr__(self): return self.title
class UserModel(db.Model): __tablename__ = 'user' user_id = db.Column(db.String(32), primary_key=True) additional_type = db.Column(db.Enum(AdditionalTypeChoice), nullable=False, default=AdditionalTypeChoice.NONE) email = db.Column(db.String(50), unique=True, nullable=False) password = db.Column(db.String(100), nullable=False) graduate_type = db.Column(db.Enum(GraduateChoice), nullable=False, default=GraduateChoice.WILL) admission = db.Column(db.Enum(AdmissionChoice), nullable=False, default=AdmissionChoice.NORMAL) admission_detail = db.Column(db.Enum(AdmissionDetailChoice), nullable=False, default=AdmissionDetailChoice.NONE) region = db.Column(db.Boolean, nullable=False, default=False) created_at = db.Column(db.DateTime, nullable=False) updated_at = db.Column(db.DateTime, nullable=False) # one to one apply_status = relationship("ApplyStatusModel", uselist=False, backref="user_apply_status") document = relationship("DocumentModel", uselist=False, backref="user_document") ged_score = relationship("GedScoreModel", uselist=False, backref="user_ged_score") graduate_score = relationship("GraduateScoreModel", uselist=False, backref="user_graduate_score") graduate_info = relationship("GraduateInfoModel", uselist=False, backref="user_graduate_info") info = relationship("InfoModel", uselist=False, backref="user_info") # one to many graduate_grade = relationship("GraduateGradeModel")
class PointTransactionLog(db.Model, BaseModel): # table name __tablename__ = 'point_transaction_log' # displayed fields visible = [ 'id', 'booth_id', 'user_id', 'amount', 'created_at', 'updated_at' ] # columns definitions id = db.Column(db.Integer, primary_key=True) booth_id = db.Column(db.String(40), db.ForeignKey('booths.id'), nullable=False) booth = db.relationship('Booth') user_id = db.Column(db.String(40), db.ForeignKey('users.id'), nullable=False) user = db.relationship('User') amount = db.Column(db.Integer) created_at = db.Column(db.DateTime) updated_at = db.Column(db.DateTime) def __init__(self): self.created_at = datetime.datetime.now() self.updated_at = datetime.datetime.now()
class TemplateGeneCard(db.Model): __tablename__ = 'template_gene_card' id = db.Column(db.Integer(), primary_key=True) name = db.Column(db.String(200)) # gene名称 transcript = db.Column(db.String(200)) # 转录本 gene_func = db.Column(db.String(2000)) # 基因功能 gene_cancer = db.Column(db.String(2000)) # 基因与肿瘤的关系
class User(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100)) email = db.Column(db.String(100)) def __serialize__(self): return {'id': self.id, 'name': self.name, 'email': self.email}
class TeamsModel(db.Model): __tablename__ = 'teams' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(5), unique=True) coach = db.Column(db.String(255), nullable=False) def __init__(self, name, coach): self.name = name self.coach = coach def save_to_db(self): db.session.add(self) db.session.commit() def update(self): db.session.commit() def delete_from_db(self): db.session.delete(self) db.session.commit() @classmethod def get_all(cls): return cls.query.all() @classmethod def find_by_id(cls, _id): return cls.query.filter_by(id=_id).first()
class Recipe(BaseModel, db.Model): __tablename__ = "Recipe" id = db.Column(db.Integer, primary_key=True) category = db.Column(db.Integer) name = db.Column(db.String(120)) email = db.Column(db.String(120)) description = db.Column(db.Text()) ingredients = db.Column(db.Text()) def __init__(self, category, name, email, description, ingredients): self.category = category self.name = name self.email = email self.description = description self.ingredients = ingredients def serialize(self): return { 'id': self.id, 'email': self.email, 'name': self.name, 'description': self.description, 'ingredients': self.ingredients }
class Spot(db.Model, BaseModel): # table name __tablename__ = 'spots' # displayed fields visible = ['id', 'beacon_id', 'stage_id', 'coordinate_x', 'coordinate_y', 'created_at', 'updated_at'] # columns definitions id = db.Column(db.Integer, primary_key=True) beacon_id = db.Column( db.String(40), db.ForeignKey('beacons.id'), nullable=True ) beacon = db.relationship('Beacon') stage_id = db.Column( db.String(40), db.ForeignKey('stages.id'), nullable=True ) stage = db.relationship('Stage') coordinate_x = db.Column(db.Integer) coordinate_y = db.Column(db.Integer) created_at = db.Column(db.DateTime) updated_at = db.Column(db.DateTime) def __init__(self): self.created_at = datetime.datetime.now() self.updated_at = datetime.datetime.now()
class Regular(User): __tablename__ = 'regular' user_id = db.Column(db.Integer, db.ForeignKey('user.user_id'), primary_key=True) gender = db.Column(db.String(50)) age = db.Column(db.String(50)) height = db.Column(db.String(50)) leadership = db.Column(db.String(30)) ethnicity = db.Column(db.String(30)) personality = db.Column(db.String(30)) education = db.Column(db.String(50)) hobby = db.Column(db.String(50)) faculty = db.Column(db.String(50)) occupation = db.Column(db.String(50)) def __init__(self, type, first_name, last_name, email, username, password, gender, age, height, leadership, ethnicity, personality, education, hobby, faculty, occupation): super().__init__(type, first_name, last_name, email, username, password) self.ethnicity = ethnicity self.age = age self.height = height self.personality = personality self.leadership = leadership self.gender = gender self.hobby = hobby self.education = education self.faculty = faculty self.occupation = occupation __mapper_args__ = {'polymorphic_identity': 'Regular'}
class Dog(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64), nullable=False) details = db.Column(db.String(300), nullable=True) owner_id = db.Column(db.Integer, db.ForeignKey('owner.id', ondelete="CASCADE")) breed_id = db.Column(db.Integer, db.ForeignKey('breed.id')) gender = db.Column(db.Boolean, nullable=False) breed = db.relationship("Breed", backref="dog", cascade="all, delete") photos = db.relationship("Photo", backref="dog", cascade="all, delete", passive_deletes=True) interest = db.relationship("Interest", backref="dog", cascade="all, delete") conversations = db.relationship('Conversation', secondary=dog_conversation, back_populates='dogs', cascade="all, delete") messages = db.relationship('Message', back_populates='dogs', cascade="all, delete", passive_deletes=True) def __repr__(self): return f"<Dog {self.name} />"
class User(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(40), unique=True, nullable=False) hash_password = db.Column(db.String(128)) is_admin = db.Column(db.Boolean, nullable=False, server_default='0') roles = db.relationship('Role', secondary=roles, lazy='dynamic', backref=db.backref('users', lazy=True)) create_time = db.Column(db.DateTime, nullable=False, server_default=text('CURRENT_TIMESTAMP')) def set_hash_password(self, password: str): self.hash_password = generate_password_hash(self.name + password) def verify_password(self, password: str): return check_password_hash(self.hash_password, self.name + password) def __repr__(self): return f'<User> [name]{self.name} [open_id]{self.user_open_id}' def generate_auth_token(self, expiration=60 * 60): s = TimedJSONWebSignatureSerializer(current_app.config['SECRET_KEY'], expires_in=expiration) return s.dumps({'id': self.id}) def generate_refresh_token(self, expiration=30 * 24 * 60 * 60): s = TimedJSONWebSignatureSerializer(current_app.config['REFRESH_KEY'], expires_in=expiration) return s.dumps({'id': self.id, 'hash': self.hash_password}) @staticmethod def verify_auth_token(token): s = TimedJSONWebSignatureSerializer(current_app.config['SECRET_KEY']) try: data = s.loads(token) except SignatureExpired as e: print('expired') data = e.payload return None # valid token, but expired except BadSignature: print('invalid') return None # invalid token user = User.query.get(data['id']) return user @staticmethod def verify_refresh_token(token): s = TimedJSONWebSignatureSerializer(current_app.config['REFRESH_KEY']) try: data = s.loads(token) except SignatureExpired as e: print('expired') return None # valid token, but expired except BadSignature: print('invalid') return None # invalid token user = User.query.get(data['id']) return user def serializer(self): return { 'name': self.name, 'token': self.generate_auth_token().decode('ascii'), "is_admin": self.is_admin, }
class UserEmail(SoftDeletionModel): """user email model class""" __tablename__ = 'user_emails' id = db.Column(db.Integer, primary_key=True) email_address = db.Column(db.String(120), unique=True, nullable=False) type = db.Column(db.String(120), nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('users.id', ondelete='CASCADE')) user = db.relationship("User", backref="alternate_emails", foreign_keys=[user_id]) def __init__(self, email_address=None, type=None, user_id=None, deleted_at=None): self.email_address = email_address self.type = type self.user_id = user_id self.deleted_at = deleted_at def __repr__(self): return '<Email %r>' % self.email_address def __str__(self): return self.__repr__()
class User(BaseModel): __tablename__ = 'users' STATUS_ACTIVE = 'active' STATUS_BLOCKED = 'blocked' STATUSES = [STATUS_ACTIVE, STATUS_BLOCKED] ROLE_USER = '******' ROLE_ADMIN = 'admin' id = db.Column(db.Integer(), primary_key=True) username = db.Column(db.String(100), unique=True, nullable=False, index=True) password = db.Column(db.String(150)) status = db.Column(db.String(30), nullable=False, default=STATUS_ACTIVE, index=True) role = db.Column(db.String(30), nullable=False, default=ROLE_USER, index=True) count_recipes = db.Column(db.Integer(), default=0) count_likes = db.Column(db.Integer(), default=0) def set_password(self, password): self.password = sha256_crypt.hash(password) def check_password(self, password): return sha256_crypt.verify(password, self.password)
class AccessToken(db.Model, BaseModel): # table name __tablename__ = 'access_tokens' # visible fields visible = [ 'id', 'user_id', 'access_token', 'refresh_token', 'client_id', 'created_at', 'updated_at' ] # columns definitions id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.String(40), db.ForeignKey('users.id'), nullable=False) user = db.relationship('User') client_id = db.Column(db.String(40), db.ForeignKey('clients.id'), nullable=False) client = db.relationship('Client') access_token = db.Column(db.String) refresh_token = db.Column(db.String) created_at = db.Column(db.DateTime) updated_at = db.Column(db.DateTime) def __init__(self): self.created_at = datetime.datetime.now() self.updated_at = datetime.datetime.now() def init_token(self, access_token, refresh_token, user_id): self.access_token = access_token self.refresh_token = refresh_token self.user_id = user_id return self
class User(db.Model): __tablename__ = 'users' __table_args__ = {'schema': 'mydwtool'} id = db.Column(db.Integer, primary_key=True) nickname = db.Column(db.String(64), unique=True) email = db.Column(db.String(120), unique=True) password = db.Column(db.String(255), unique=True) role = db.Column(db.String(255), default='public') def __init__(self, id, nickname, email, password, role='public'): self.id = id self.nickname = nickname self.email = email self.password = password self.role = role def is_authenticated(self): return True def is_active(self): return True def is_anonymous(self): return False def get_id(self): return self.id def __repr__(self): return '<User %r>' % (self.nickname)
class News(db.Model): __tablename__ = 'gk-news' id = db.Column('news_id', db.Integer, primary_key=True, key='id') title = db.Column('tytul', db.String(50), key='title', nullable=False) content = db.Column('tresc', db.Text, key='content', nullable=False) username = db.Column('who', db.String(20), key='username', nullable=True) author_id = db.Column('userid', db.Integer, db.ForeignKey('gk-users.id'), key='author_id') comments_count = db.Column('komentarze', db.Integer, key='comments_count', default=0) last_comment_date_time = db.Column('ostatni_komentarz', db.DateTime, key='last_comment_date_time', nullable=False, default="0000-00-00 00:00:00") created_on_date_time = db.Column('date', db.DateTime, key='created_on_date_time', default=datetime.datetime.utcnow) czas_postu = db.Column(db.DateTime, default="0000-00-00 00:00:00") # author = db.relationship('User', backref=db.backref('news')) news_comments = db.relationship('NewsComment', backref="news", cascade="all,delete") news_subscriptions = db.relationship('NewsSubscription', backref="news", cascade="all,delete")
class Booth(db.Model, BaseModel): # table name __tablename__ = 'booths' # displayed fields visible = [ 'id', 'user_id', 'stage_id', 'points', 'summary', 'type', 'logo_url', 'url', 'name', 'channel_id', 'created_at', 'updated_at' ] # columns definitions id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.String(40), db.ForeignKey('users.id'), nullable=True) user = db.relationship('User') stage_id = db.Column(db.String(40), db.ForeignKey('stages.id')) stage = db.relationship('Stage') summary = db.Column(db.Text) type = db.Column(db.String) channel_id = db.Column(db.String) points = db.Column(db.Integer) name = db.Column(db.String(255)) url = db.Column(db.String(255)) logo_url = db.Column(db.String(255)) created_at = db.Column(db.DateTime) updated_at = db.Column(db.DateTime) def __init__(self): self.created_at = datetime.datetime.now() self.updated_at = datetime.datetime.now() self.summary = '' self.points = 0
class Schedule(db.Model, BaseModel): # table name __tablename__ = 'schedules' # displayed fields visible = ['id', 'event_id', 'stage_id', 'time_start', 'time_end', 'created_at', 'updated_at'] # columns definitions id = db.Column(db.Integer, primary_key=True) event_id = db.Column( db.String(40), db.ForeignKey('events.id'), nullable=False ) event = db.relationship('Event') stage_id = db.Column( db.String(40), db.ForeignKey('stages.id'), nullable=False ) stage = db.relationship('Stage') time_start = db.Column(db.DateTime) time_end = db.Column(db.DateTime) created_at = db.Column(db.DateTime) updated_at = db.Column(db.DateTime) def __init__(self): self.created_at = datetime.datetime.now() self.updated_at = datetime.datetime.now()
class User(_Base): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) OpenID = db.Column(db.String(5), unique=True, nullable=False) _session_key = db.Column('session_key', db.String(128), nullable=False) comments = db.relationship('Comment', backref='user', lazy='dynamic') @property def session_key(self): return self._session_key @session_key.setter def session_key(self, key): self._session_key = generate_password_hash(key) @staticmethod def user_verify(id, key): user = User.query.filter_by(OpenID=id).first() if not user: raise APIException(code=404, error_code=2000, message='no this user') if not user.check_key(key): raise APIException(code=401, error_code=4001, message='Authorization fail') return {'uid': user.id} # 利用此函数来实现验证, 返回的是True, False def check_key(self, key): return check_password_hash(self._session_key, key)
class User(db.Model): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(120), index=True, unique=True) password_hash = db.Column(db.String(128)) def __repr__(self): return '<User {}>'.format(self.email)
class Ticket(Base): __tablename__ = 'ticket' id = db.Column(db.Integer(), primary_key=True) date = db.Column(db.Date()) updated = db.Column(db.DateTime(timezone=True)) um = db.Column(db.String(10)) cost = db.Column(db.Float(scale=17, precision=3)) total = db.Column(db.Float(scale=17, precision=3)) total_tax_paid = db.Column(db.Float(scale=16, precision=2)) total_no_tax = total - total_tax_paid project_task_id = db.Column(db.Integer()) project_task_name = db.Column(db.String(200)) user_id = db.Column(db.Integer()) project_id = db.Column(db.Integer()) project_name = db.Column(db.String(200)) currency = db.Column(db.String(3)) city = db.Column(db.String(75)) quantity = db.Column(db.Float(scale=12, precision=2)) acct_date = db.Column(db.Date()) @staticmethod def get_my_tickets(user_email): query = '''SELECT DISTINCT t.id, t.date, t.updated, t.um, t.cost, t.total, t.total_tax_paid, t.project_task_id, pt.name AS project_task_name, t.user_id, t.project_id, p.name AS project_name, t.currency, t.city, t.quantity, t.acct_date FROM ticket t INNER JOIN envelope e ON t.envelope_id = e.id INNER JOIN project p ON e.project_id = p.id LEFT JOIN project_task pt ON t.project_task_id = t.id LEFT JOIN user u ON t.user_id=u.id WHERE u.email = :email OR p.id IN (SELECT DISTINCT p2.id FROM project p2 LEFT JOIN project_task pt2 ON pt2.project_id = p2.id LEFT JOIN project_task_assign pta ON pta.project_task_id = pt2.id LEFT JOIN booking b ON b.project_id = p2.id LEFT JOIN user u ON (p2.user_id = u.id OR pta.user_id = u.id OR b.user_id = u.id) WHERE u.email = :email AND p2.active="1");''' return Ticket.query.from_statement( text(query)).params(email=user_email).all() def __repr__(self): return '<Ticket %r>' % self.id
class Book(_Base): __tablename__ = 'books' """ 一些属性定义重复性比较大,元类可以解决这个问题 """ id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(20), nullable=True) author = db.Column(db.String(20), default='未名') publisher = db.Column(db.String(15)) price = db.Column(db.Integer) summary = db.Column(db.String(500), default='无') _image = db.Column('image', db.String(20)) comments = db.relationship('Comment', backref='book', lazy='dynamic') @property def image(self): from flask import url_for burl = url_for('static', filename='book/image/', _external=True) + self._image return burl @image.setter def image(self, value): self._image = value @classmethod def get_books(cls, page): next, prev = None, None pagination = Book.query.order_by( Book.create_time).paginate( page=page, per_page=current_app.config['BOOK_LIMIT'], error_out=False) # items取得recent_books的模型列表 books = pagination.items if pagination.has_next: next = url_for('v1.recent', page=page + 1, _external=True) if pagination.has_prev: prev = url_for('v1.recent', page=page + 1, _external=True) data = jsonify({ 'books': [ book.to_json() for book in books ], 'prev': prev, 'next': next, 'count': pagination.total }) return data def to_json(self): json_book = { 'url': url_for('v1.recent', bid=self.id, _external=True), 'title': self.title, 'author': self.author, 'publisher': self.publisher, 'price': self.price, 'summary': self.summary, 'image': self.image } return json_book
class UserModel(db.Model): __tablename__ = 'User' id = db.Column(db.String(100), primary_key=True) password = db.Column(db.String(100), nullable=False) menstruation_period = db.Column(db.Integer, nullable=False) is_rhythm_contraception = db.Column(db.Boolean, nullable=False) is_standard_contraception = db.Column(db.Boolean, nullable=False) push_notification = db.Column(db.Boolean, default=True)