Lerndatenbank/models.py

17 lines
855 B
Python
Raw Normal View History

2024-08-05 17:48:09 +02:00
# Import necessary modules
from flask_sqlalchemy import SQLAlchemy
2024-08-05 16:36:41 +02:00
2024-08-05 17:48:09 +02:00
# Create an instance of SQLAlchemy and assign it to db
db = SQLAlchemy()
# Define a User model class that inherits from db.Model
class table_user(db.Model):
# Define the id column as an integer primary key
2024-08-05 16:36:41 +02:00
id = db.Column(db.Integer, primary_key=True)
2024-08-05 17:48:09 +02:00
# Define the user_name column as a string with max length 80 and must be unique and not nullable
user_name = db.Column(db.String(80), unique=True, nullable=False)
# Define the user_password column as a string with max length 120 and must be unique and not nullable
user_password = db.Column(db.String(120), unique=True, nullable=False)
# Define the user_email column as a string with max length 120 and must be unique and not nullable
user_email = db.Column(db.String(120), unique=True, nullable=False)