This is my first model:
class Userauth(db.Model):
__tablename__ = 'userauth'
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(50), unique = True, nullable = False)
password = db.Column(db.String(50), nullable = False)
After I made my table in my database, then I'm trying to sign up or create a new user but I got this error:
"Something went wrong: (psycopg2.errors.StringDataRightTruncation) value too long for type character varying(50)"
I realize that I encode the password so it exceeds 50 characters, so I change my code from
password = db.Column(db.String(50), nullable = False)
to
password = db.Column(db.String(150), nullable = False)
But I still got the same error. When I check my database, my table didn't change the char value from 50 to 150. I have migrated and upgrade my database with python manage.py db migrate
and upgrade
, and there is no error for that but why my table didn't change? Is there any easy way to change or update our table in Flask? (I work with flask-sqlalchemy also), thank you.