forked from cardosofelipe/fast-next-template
Clean up Alembic migrations
- Removed outdated and redundant Alembic migration files to streamline the migration directory. This improves maintainability and eliminates duplicate or unused scripts.
This commit is contained in:
@@ -24,6 +24,9 @@ class OAuthAuthorizationCode(Base, UUIDMixin, TimestampMixin):
|
||||
- Must validate redirect_uri matches exactly
|
||||
- Must verify PKCE code_verifier for public clients
|
||||
- Must be consumed within expiration time
|
||||
|
||||
Performance indexes (defined in migration 0002_add_performance_indexes.py):
|
||||
- ix_perf_oauth_auth_codes_expires: expires_at WHERE used = false
|
||||
"""
|
||||
|
||||
__tablename__ = "oauth_authorization_codes"
|
||||
|
||||
@@ -27,6 +27,9 @@ class OAuthProviderRefreshToken(Base, UUIDMixin, TimestampMixin):
|
||||
- Support token rotation (new refresh token on use)
|
||||
- Track last used time for security auditing
|
||||
- Support revocation by user, client, or admin
|
||||
|
||||
Performance indexes (defined in migration 0002_add_performance_indexes.py):
|
||||
- ix_perf_oauth_refresh_tokens_expires: expires_at WHERE revoked = false
|
||||
"""
|
||||
|
||||
__tablename__ = "oauth_provider_refresh_tokens"
|
||||
|
||||
@@ -10,6 +10,9 @@ class Organization(Base, UUIDMixin, TimestampMixin):
|
||||
"""
|
||||
Organization model for multi-tenant support.
|
||||
Users can belong to multiple organizations with different roles.
|
||||
|
||||
Performance indexes (defined in migration 0002_add_performance_indexes.py):
|
||||
- ix_perf_organizations_slug_lower: LOWER(slug) WHERE is_active = true
|
||||
"""
|
||||
|
||||
__tablename__ = "organizations"
|
||||
|
||||
@@ -6,6 +6,14 @@ from .base import Base, TimestampMixin, UUIDMixin
|
||||
|
||||
|
||||
class User(Base, UUIDMixin, TimestampMixin):
|
||||
"""
|
||||
User model for authentication and profile data.
|
||||
|
||||
Performance indexes (defined in migration 0002_add_performance_indexes.py):
|
||||
- ix_perf_users_email_lower: LOWER(email) WHERE deleted_at IS NULL
|
||||
- ix_perf_users_active: is_active WHERE deleted_at IS NULL
|
||||
"""
|
||||
|
||||
__tablename__ = "users"
|
||||
|
||||
email = Column(String(255), unique=True, nullable=False, index=True)
|
||||
|
||||
@@ -44,7 +44,7 @@ class UserOrganization(Base, TimestampMixin):
|
||||
Enum(OrganizationRole),
|
||||
default=OrganizationRole.MEMBER,
|
||||
nullable=False,
|
||||
index=True,
|
||||
# Note: index defined in __table_args__ as ix_user_org_role
|
||||
)
|
||||
is_active = Column(Boolean, default=True, nullable=False, index=True)
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ class UserSession(Base, UUIDMixin, TimestampMixin):
|
||||
|
||||
Each time a user logs in from a device, a new session is created.
|
||||
Sessions are identified by the refresh token JTI (JWT ID).
|
||||
|
||||
Performance indexes (defined in migration 0002_add_performance_indexes.py):
|
||||
- ix_perf_user_sessions_expires: expires_at WHERE is_active = true
|
||||
"""
|
||||
|
||||
__tablename__ = "user_sessions"
|
||||
|
||||
Reference in New Issue
Block a user