update token_type to string instead of enum (#3087)
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
"""add 1password service account token type
|
||||||
|
|
||||||
|
Revision ID: 2e58ef1b3d8b
|
||||||
|
Revises: 1b2a8b62de61
|
||||||
|
Create Date: 2025-08-01 16:31:37.315522+00:00
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
from typing import Sequence, Union
|
||||||
|
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision: str = "2e58ef1b3d8b"
|
||||||
|
down_revision: Union[str, None] = "1b2a8b62de61"
|
||||||
|
branch_labels: Union[str, Sequence[str], None] = None
|
||||||
|
depends_on: Union[str, Sequence[str], None] = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.alter_column(
|
||||||
|
"organization_auth_tokens",
|
||||||
|
"token_type",
|
||||||
|
existing_type=postgresql.ENUM("api", name="organizationauthtokentype"),
|
||||||
|
type_=sa.String(),
|
||||||
|
existing_nullable=False,
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.alter_column(
|
||||||
|
"organization_auth_tokens",
|
||||||
|
"token_type",
|
||||||
|
existing_type=sa.String(),
|
||||||
|
type_=postgresql.ENUM("api", name="organizationauthtokentype"),
|
||||||
|
existing_nullable=False,
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
||||||
@@ -3,6 +3,7 @@ from enum import StrEnum
|
|||||||
|
|
||||||
class OrganizationAuthTokenType(StrEnum):
|
class OrganizationAuthTokenType(StrEnum):
|
||||||
api = "api"
|
api = "api"
|
||||||
|
onepassword_service_account = "onepassword_service_account"
|
||||||
|
|
||||||
|
|
||||||
class TaskType(StrEnum):
|
class TaskType(StrEnum):
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ from sqlalchemy import (
|
|||||||
Boolean,
|
Boolean,
|
||||||
Column,
|
Column,
|
||||||
DateTime,
|
DateTime,
|
||||||
Enum,
|
|
||||||
ForeignKey,
|
ForeignKey,
|
||||||
Index,
|
Index,
|
||||||
Integer,
|
Integer,
|
||||||
@@ -18,7 +17,7 @@ from sqlalchemy import (
|
|||||||
from sqlalchemy.ext.asyncio import AsyncAttrs
|
from sqlalchemy.ext.asyncio import AsyncAttrs
|
||||||
from sqlalchemy.orm import DeclarativeBase
|
from sqlalchemy.orm import DeclarativeBase
|
||||||
|
|
||||||
from skyvern.forge.sdk.db.enums import OrganizationAuthTokenType, TaskType
|
from skyvern.forge.sdk.db.enums import TaskType
|
||||||
from skyvern.forge.sdk.db.id import (
|
from skyvern.forge.sdk.db.id import (
|
||||||
generate_action_id,
|
generate_action_id,
|
||||||
generate_ai_suggestion_id,
|
generate_ai_suggestion_id,
|
||||||
@@ -167,7 +166,7 @@ class OrganizationAuthTokenModel(Base):
|
|||||||
)
|
)
|
||||||
|
|
||||||
organization_id = Column(String, ForeignKey("organizations.organization_id"), index=True, nullable=False)
|
organization_id = Column(String, ForeignKey("organizations.organization_id"), index=True, nullable=False)
|
||||||
token_type = Column(Enum(OrganizationAuthTokenType), nullable=False)
|
token_type = Column(String, nullable=False)
|
||||||
token = Column(String, index=True, nullable=False)
|
token = Column(String, index=True, nullable=False)
|
||||||
valid = Column(Boolean, nullable=False, default=True)
|
valid = Column(Boolean, nullable=False, default=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user