ephraimbuddy commented on code in PR #62234:
URL: https://github.com/apache/airflow/pull/62234#discussion_r2926512780
##########
providers/fab/src/airflow/providers/fab/auth_manager/models/__init__.py:
##########
@@ -372,19 +391,19 @@ class RegisterUser(Model):
registration_hash: Mapped[str | None] = mapped_column(String(256))
+_idx_ab_user_username = Index("idx_ab_user_username",
func.lower(User.__table__.c.username), unique=True)
+_idx_ab_register_user_username = Index(
+ "idx_ab_register_user_username",
func.lower(RegisterUser.__table__.c.username), unique=True
+)
+
+
@event.listens_for(User.__table__, "before_create")
def add_index_on_ab_user_username_postgres(table, conn, **kw):
if conn.dialect.name != "postgresql":
- return
- index_name = "idx_ab_user_username"
- if not any(table_index.name == index_name for table_index in
table.indexes):
- table.indexes.add(Index(index_name, func.lower(table.c.username),
unique=True))
+ table.indexes.discard(_idx_ab_user_username)
@event.listens_for(RegisterUser.__table__, "before_create")
def add_index_on_ab_register_user_username_postgres(table, conn, **kw):
if conn.dialect.name != "postgresql":
- return
- index_name = "idx_ab_register_user_username"
- if not any(table_index.name == index_name for table_index in
table.indexes):
- table.indexes.add(Index(index_name, func.lower(table.c.username),
unique=True))
+ table.indexes.discard(_idx_ab_register_user_username)
Review Comment:
Added _restore* functions
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]