sqlalchemy on delete set null
snippet in sql

sqlalchemy on delete set null

user3351

category_id = db.Column(db.Integer, db.ForeignKey('category.id', ondelete='SET NULL'))