python - Flask-SQLAlchemy specified key too long -


i have following flask-sqlalchemy schema:

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 

which generates sql (i'm using mysql):

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)) ) 

however, gives me error "specified key long; max key length 767 bytes".

note not duplicate of can't create_all flask-sqlalchemy - specified key long; question suggested shortening unique column lengths <255 characters, , have tried no success.

i like, if possible, keep email field @ 254 characters max length defined spec.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -