2024-09-02 09:02:32 +02:00
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
|
|
|
|
db = SQLAlchemy()
|
|
|
|
|
|
|
|
class Game(db.Model):
|
2024-09-02 09:42:47 +02:00
|
|
|
__tablename__ = 'games' # Ensure the table name is set to 'games'
|
2024-09-02 09:02:32 +02:00
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
image = db.Column(db.String(255))
|
|
|
|
title = db.Column(db.String(100), nullable=False)
|
2024-09-02 09:49:10 +02:00
|
|
|
date = db.Column(db.String(10), nullable=False) # Ensure date is not nullable
|
2024-09-02 09:02:32 +02:00
|
|
|
buyer = db.Column(db.String(100))
|
|
|
|
owned = db.Column(db.Boolean, nullable=False)
|
2024-09-02 10:32:26 +02:00
|
|
|
|
|
|
|
class User(db.Model):
|
|
|
|
__tablename__ = 'users' # Ensure the table name is set to 'users'
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
username = db.Column(db.String(100), nullable=False, unique=True)
|
|
|
|
password = db.Column(db.String(100), nullable=False)
|
|
|
|
role = db.Column(db.String(10), nullable=False) # 'user' or 'admin'
|
|
|
|
last_login = db.Column(db.String(20), nullable=True) # Last login timestamp
|