<commit_before># Copyright 2014 SolidBuilds.com. All rights reserved
#
# Authors: <NAME> <<EMAIL>>

from flask_uploads import UploadSet, IMAGES, configure_uploads
from flask_user import UserMixin
from flask_user.forms import RegisterForm
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from wtforms import StringField, SubmitField, validators
from app.init_app import db, app

class Friendship(db.Model):
    __tablename__ = 'friendships'
    id = db.Column(db.Integer(), primary_key=True)
    friender_id = db.Column(db.Integer(), db.ForeignKey('users.id', ondelete='CASCADE'))
    friendee_id = db.Column(db.Integer(), db.ForeignKey('users.id', ondelete='CASCADE'))
    friender = db.relationship("User", foreign_keys=[friender_id],
                               back_populates="friendships")

    friendee = db.relationship("User", foreign_keys=[friendee_id],
                               back_populates="cofriendships")
    

# Define the User data model. Make sure to add the flask_user.UserMixin !!
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)
    confirmed_at = db.Column(db.DateTime())
    password = db.Column(db.String(255), nullable=False, server_default='')
    # reset_password_token = db.Column(db.String(100), 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')
    first_name = db.Column(db.Unicode(50), nullable=False, server_default=u'')
    last_name = db.Column(db.Unicode(50), nullable=False, server_default=u'')
    photo_file_name = db.Column('photo_file_name',db.Unicode(260), nullable=True, server_default=u'')

    # Relationships
    roles = db.relationship('Role', secondary='users_roles',
                            backref=db.backref('users', lazy='dynamic'))

    friendships = db.relationship('Friendship', foreign_keys=[Friendship.friender_id])
    cofriendships = db.relationship('Friendship', foreign_keys=[Friendship.friendee_id])

 
# Define the Role data model
class Role(db.Model):
    __tablename__ = 'roles'
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(50), nullable=False, server_default=u'', unique=True)  # for @roles_accepted()
    label = db.Column(db.Unicode(255), server_default=u'')  # for display purposes
    

class Graph(db.Model):
    __tablename__ = 'graphs'
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(50), nullable=False, server_default=u'')
    description = db.Column(db.String(1000), nullable=False, server_default=u'')
    nodes = db.Column(db.String(10 * 1000), nullable=False, server_default=u'')
    edges = db.Column(db.String(10 * 1000), nullable=False, server_default=u'')

    # Relationships
    owners = db.relationship('User', secondary='users_graphs_owner', backref=db.backref('graphs_owned', lazy='dynamic'))<commit_msg>Unicode to String for users.photo_file_name column in db<commit_after># Copyright 2014 SolidBuilds.com. All rights reserved
#
# Authors: <NAME> <<EMAIL>>

from flask_uploads import UploadSet, IMAGES, configure_uploads
from flask_user import UserMixin
from flask_user.forms import RegisterForm
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from wtforms import StringField, SubmitField, validators
from app.init_app import db, app

class Friendship(db.Model):
    __tablename__ = 'friendships'
    id = db.Column(db.Integer(), primary_key=True)
    friender_id = db.Column(db.Integer(), db.ForeignKey('users.id', ondelete='CASCADE'))
    friendee_id = db.Column(db.Integer(), db.ForeignKey('users.id', ondelete='CASCADE'))
    friender = db.relationship("User", foreign_keys=[friender_id],
                               back_populates="friendships")

    friendee = db.relationship("User", foreign_keys=[friendee_id],
                               back_populates="cofriendships")
    

# Define the User data model. Make sure to add the flask_user.UserMixin !!
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)
    confirmed_at = db.Column(db.DateTime())
    password = db.Column(db.String(255), nullable=False, server_default='')
    # reset_password_token = db.Column(db.String(100), 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')
    first_name = db.Column(db.Unicode(50), nullable=False, server_default=u'')
    last_name = db.Column(db.Unicode(50), nullable=False, server_default=u'')
    photo_file_name = db.Column('photo_file_name',db.String(260), nullable=True, server_default=u'')

    # Relationships
    roles = db.relationship('Role', secondary='users_roles',
                            backref=db.backref('users', lazy='dynamic'))

    friendships = db.relationship('Friendship', foreign_keys=[Friendship.friender_id])
    cofriendships = db.relationship('Friendship', foreign_keys=[Friendship.friendee_id])

 
# Define the Role data model
class Role(db.Model):
    __tablename__ = 'roles'
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(50), nullable=False, server_default=u'', unique=True)  # for @roles_accepted()
    label = db.Column(db.Unicode(255), server_default=u'')  # for display purposes
    

class Graph(db.Model):
    __tablename__ = 'graphs'
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(50), nullable=False, server_default=u'')
    description = db.Column(db.String(1000), nullable=False, server_default=u'')
    nodes = db.Column(db.String(10 * 1000), nullable=False, server_default=u'')
    edges = db.Column(db.String(10 * 1000), nullable=False, server_default=u'')

    # Relationships
    owners = db.relationship('User', secondary='users_graphs_owner', backref=db.backref('graphs_owned', lazy='dynamic'))
{'fraction_non_alphanumeric': 0.1350046714419184, 'fraction_numerical': 0.014014325755216444, 'mean_word_length': 4.639157155399473, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5651947', 'n_tokens_mistral': 2126, 'n_tokens_neox': 2025, 'n_words': 402}