class Podcast(db.Model): # we want to change the name of this table as it is basically a subscriptions table. id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey("users.id"), nullable=False) name = db.Column(db.String(500)) rss_feed_url = db.Column(db.String(2000)) podcast_API_id = db.Column(db.Integer)
class LikedImages(db.Model): id = db.Column(db.Integer, primary_key=True) image_link = db.Column(db.String, db.ForeignKey('images.link'), nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False) owner_id = db.Column(db.Integer, nullable=False)
class Users(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(25), unique=True) password = db.Column(db.String(128), nullable=False) salt = db.Column(db.String(40), nullable=False) user_history = relationship('History', backref='users') playlists = relationship('Playlists')
class Messages(db.Model): id = db.Column(db.Integer, primary_key=True) message = db.Column(db.String(600), nullable=False) first_user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False) second_user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False) message_time_utc = db.Column(db.String(200), nullable=False)
class History(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) user_id = db.Column(db.Integer, db.ForeignKey("users.id")) episode_title = db.Column(db.String) episode_summary = db.Column(db.String) episode_url = db.Column(db.String) time_stamp_accessed = db.Column(db.DateTime, default=datetime.now()) current_time_listened = db.Column(db.Integer) parent_podcast_id = db.Column(db.Integer) parent_podcast_art_url = db.Column(db.String)
class Playlists(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(500)) user_id = db.Column(db.Integer, db.ForeignKey("users.id")) def __init__(self, name, user_id): self.name = name self.user_id = user_id def save(self): db.session.add(self) db.session.commit() items = relationship("PlaylistItems")
class Users(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(500)) pw_hash = db.Column(db.String(500)) time_zone = db.Column(db.String(120)) images = db.relationship('Images', backref='users', lazy=True) likedimages = db.relationship('LikedImages', backref='users', lazy=True) #flask sqlalchemy magic(line above this). # This actually allows us to reference the User's table in # other tables like images and likedimages using the backref function # this documentation explains it: https://docs.sqlalchemy.org/en/13/orm/backref.html def __init__(self, username, password): self.username = username self.pw_hash = make_pw_hash(password) #checking salted and hashed pass
class MuseumActivities(db.Model): id = db.Column(db.Integer, primary_key=True) museum_id = db.Column(db.Integer, db.ForeignKey('museum_info.id'), nullable=False) activity_name = db.Column(db.String(500)) activity_description = db.Column(db.String(500)) number_of_kids_taken = db.Column(db.Integer) low_age_range_of_child_taken = db.Column(db.Integer) high_age_range_of_child_taken = db.Column(db.Integer)
class Variables(db.Model): __tablename__ = 'APPLICANTS' id = db.Column(db.Integer, primary_key=True) SeriousDlqin2yrs = db.Column(db.Integer) RevolvingUtilizationOfUnsecuredLines = db.Column(db.Float) age = db.Column(db.Integer) NumberOfTime30to59DaysPastDueNotWorse = db.Column(db.Integer) DebtRatio = db.Column(db.Float) MonthlyIncome = db.Column(db.Integer) NumberOfOpenCreditLinesAndLoans = db.Column(db.Integer) NumberOfTimes90DaysLate = db.Column(db.Integer) NumberRealEstateLoansOrLines = db.Column(db.Integer) NumberOfTime60to89DaysPastDueNotWorse = db.Column(db.Integer) NumberOfDependents = db.Column(db.Integer)
class MuseumInfo(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) museum_name = db.Column(db.String(200)) museum_city = db.Column(db.String(200))
class Podcast(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(500)) rss_feed_url = db.Column(db.String(2000))
class PlaylistItems(db.Model): id = db.Column(db.Integer, primary_key=True) playlist_id = db.Column(db.Integer, db.ForeignKey("playlists.id")) episode_title = db.Column(db.String) episode_summary = db.Column(db.String) episode_url = db.Column(db.String)
class Todo(db.Model): id = db.Column(db.Integer, primary_key=True) item = db.Column(db.String(500)) done = db.Column(db.Boolean)
class Images(db.Model): id = db.Column(db.Integer, primary_key=True) link = db.Column(db.String(120), nullable=False, unique=True) user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False) likedimages = db.relationship('LikedImages', backref='images', lazy=True)