16 lines
548 B
Python
16 lines
548 B
Python
from lernplattform import db
|
|
|
|
class User(db.Model):
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
username = db.Column(db.String(20), unique=True, nullable=False)
|
|
email = db.Column(db.String(120), unique=True, nullable=False)
|
|
password = db.Column(db.String(60), nullable=False)
|
|
|
|
def __repr__(self):
|
|
return f"User('{self.username}', '{self.email}')"
|
|
|
|
def initialize_database():
|
|
from lernplattform import app
|
|
with app.app_context():
|
|
db.create_all()
|
|
print("Database and tables created successfully.") |