Skip to content

Commit

Permalink
chore: improve security models performance (#2293)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgaspar authored Dec 17, 2024
1 parent fab9013 commit 418ab8a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion flask_appbuilder/security/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Column,
DateTime,
ForeignKey,
Index,
Integer,
Sequence,
String,
Expand Down Expand Up @@ -52,6 +53,8 @@ def __repr__(self):
Column("permission_view_id", Integer, ForeignKey("ab_permission_view.id")),
Column("role_id", Integer, ForeignKey("ab_role.id")),
UniqueConstraint("permission_view_id", "role_id"),
Index("idx_permission_view_id", "permission_view_id"),
Index("idx_role_id", "role_id"),
)


Expand All @@ -72,7 +75,11 @@ def __repr__(self):

class PermissionView(Model):
__tablename__ = "ab_permission_view"
__table_args__ = (UniqueConstraint("permission_id", "view_menu_id"),)
__table_args__ = (
UniqueConstraint("permission_id", "view_menu_id"),
Index("idx_permission_id", "permission_id"),
Index("idx_view_menu_id", "view_menu_id"),
)
id = Column(Integer, Sequence("ab_permission_view_id_seq"), primary_key=True)
permission_id = Column(Integer, ForeignKey("ab_permission.id"))
permission = relationship("Permission", lazy="joined")
Expand Down

0 comments on commit 418ab8a

Please sign in to comment.