ECO-171: remove postgresql specific features

This commit is contained in:
Charles Yao 2025-11-23 20:41:13 -06:00
parent 8f6937eea6
commit 5fd83e9425

View File

@ -23,19 +23,18 @@ def upgrade():
sa.Column( sa.Column(
"id", "id",
models.types.StringUUID(), models.types.StringUUID(),
server_default=sa.text("uuid_generate_v4()"),
nullable=False, nullable=False,
), ),
sa.Column( sa.Column(
"name", "name",
sa.String(length=256), sa.String(length=256),
server_default=sa.text("'API KEY 1'::character varying"), server_default="API KEY 1",
nullable=False, nullable=False,
), ),
sa.Column("tenant_id", models.types.StringUUID(), nullable=False), sa.Column("tenant_id", models.types.StringUUID(), nullable=False),
sa.Column("end_user_id", models.types.StringUUID(), nullable=False), sa.Column("end_user_id", models.types.StringUUID(), nullable=False),
sa.Column("provider", sa.String(length=256), nullable=False), sa.Column("provider", sa.Text(), nullable=False),
sa.Column("encrypted_credentials", sa.Text(), nullable=True), sa.Column("encrypted_credentials", sa.Text(), server_default="", nullable=False),
sa.Column( sa.Column(
"created_at", "created_at",
sa.DateTime(), sa.DateTime(),
@ -51,23 +50,22 @@ def upgrade():
sa.Column( sa.Column(
"credential_type", "credential_type",
sa.String(length=32), sa.String(length=32),
server_default=sa.text("'api-key'::character varying"), server_default="api-key",
nullable=False, nullable=False,
), ),
sa.Column("expires_at", sa.BigInteger(), server_default=sa.text("-1"), nullable=False), sa.Column("expires_at", sa.BigInteger(), server_default=sa.text("-1"), nullable=False),
sa.PrimaryKeyConstraint("id", name="tool_enduser_authentication_provider_pkey"), sa.PrimaryKeyConstraint("id", name="tool_enduser_authentication_provider_pkey"),
sa.UniqueConstraint( sa.UniqueConstraint(
"tenant_id",
"provider",
"end_user_id", "end_user_id",
"provider",
"name", "name",
name="unique_enduser_authentication_provider", name="unique_enduser_authentication_provider",
), ),
) )
op.create_index( op.create_index(
"tool_enduser_authentication_provider_tenant_id_idx", "tool_enduser_authentication_provider_name_idx",
"tool_enduser_authentication_providers", "tool_enduser_authentication_providers",
["tenant_id"], ["name"],
unique=False, unique=False,
) )
op.create_index( op.create_index(
@ -76,17 +74,27 @@ def upgrade():
["end_user_id"], ["end_user_id"],
unique=False, unique=False,
) )
op.create_index(
"tool_enduser_authentication_provider_provider_idx",
"tool_enduser_authentication_providers",
["provider"],
unique=False,
)
# ### end Alembic commands ### # ### end Alembic commands ###
def downgrade(): def downgrade():
# ### commands auto generated by Alembic - please adjust! ### # ### commands auto generated by Alembic - please adjust! ###
op.drop_index(
"tool_enduser_authentication_provider_provider_idx",
table_name="tool_enduser_authentication_providers",
)
op.drop_index( op.drop_index(
"tool_enduser_authentication_provider_end_user_id_idx", "tool_enduser_authentication_provider_end_user_id_idx",
table_name="tool_enduser_authentication_providers", table_name="tool_enduser_authentication_providers",
) )
op.drop_index( op.drop_index(
"tool_enduser_authentication_provider_tenant_id_idx", "tool_enduser_authentication_provider_name_idx",
table_name="tool_enduser_authentication_providers", table_name="tool_enduser_authentication_providers",
) )
op.drop_table("tool_enduser_authentication_providers") op.drop_table("tool_enduser_authentication_providers")