Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User(db.Model, UserMixin):
- __tablename__ = "users"
- id = db.Column(db.Integer, primary_key=True)
- username = db.Column(db.String(64), nullable=False, unique=True)
- password = db.Column(db.String(255), nullable=False, server_default="")
- email = db.Column(db.String(254), nullable=False, unique=True)
- confirmed_at = db.Column(db.DateTime())
- is_enabled = db.Column(db.Boolean(), nullable=False, default=False)
- def is_active(self):
- return self.is_enabled
- CREATE TABLE users (
- id INTEGER NOT NULL AUTO_INCREMENT,
- username VARCHAR(64) NOT NULL,
- password VARCHAR(255) NOT NULL DEFAULT '',
- email VARCHAR(254) NOT NULL,
- confirmed_at DATETIME,
- is_enabled BOOL NOT NULL,
- PRIMARY KEY (id),
- UNIQUE (username),
- UNIQUE (email),
- CHECK (is_enabled IN (0, 1))
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement