MikaList/game_collection/models.py

21 lines
768 B
Python
Raw Permalink Normal View History

from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Game(db.Model):
__tablename__ = 'games'
id = db.Column(db.Integer, primary_key=True)
image = db.Column(db.String(255))
title = db.Column(db.String(100), nullable=False)
date = db.Column(db.String(10), nullable=False)
buyer = db.Column(db.String(100))
owned = db.Column(db.Boolean, nullable=False)
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(100), nullable=False, unique=True)
password = db.Column(db.String(128), nullable=False) # Increased length for hashed passwords
role = db.Column(db.String(10), nullable=False)
last_login = db.Column(db.String(20), nullable=True)