I am migrating a portal to Flask with Flask-SQLAlchemy (MySQL). Below is the code I used to create my DB for my existing portal:
Users = """CREATE TABLE Users( id INT UNSIGNED AUTO_INCREMENT NOT NULL, UserName VARCHAR(40) NOT NULL, FirstName VARCHAR(40) NOT NULL, LastName VARCHAR(40) NOT NULL, EmailAddress VARCHAR(255) NOT NULL, Password VARCHAR(40) NOT NULL, PRIMARY KEY (id) ) """
Here is how I am trying to use it in SQLAlchemy:
class Users(db.Model): id = db.Column(db.Integer, primary_key=True) UserName = db.Column(db.String(40)) FirstName = db.Column(db.String(40)) LastName = db.Column(db.String(40)) EmailAddress = db.Column(db.String(255)) Password = db.Column(db.String(40))
My question is, how can I make the SQLAlchemy model be specified as an unsigned integer?