Skip to content

Commit

Permalink
Update column types and bump version (#1653)
Browse files Browse the repository at this point in the history
* Add logger import in script.py.mako

* Fix error handling during upgrade in alembic scripts

* Bump version to 0.6.14 in pyproject.toml

* Update column types in credential and api_key models

* Bump version to 0.6.15 in pyproject.toml
  • Loading branch information
ogabrielluiz authored Apr 9, 2024
1 parent fee39ee commit e2172f4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langflow"
version = "0.6.14"
version = "0.6.15"
description = "A Python package with a built-in web application"
authors = ["Logspace <[email protected]>"]
maintainers = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def upgrade() -> None:
),
sa.Column("user_id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
sa.Column("id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
sa.Column("created_at", sa.DateTime(), nullable=False),
sa.Column("created_at", sqlmodel.sql.sqltypes.DateTime(), nullable=False),
sa.Column("updated_at", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("id"),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
from uuid import UUID, uuid4

from pydantic import validator
from sqlmodel import Field, Relationship, SQLModel
from sqlmodel import Field, Relationship, SQLModel, Field, Column, func, DateTime

if TYPE_CHECKING:
from langflow.services.database.models.user import User


class ApiKeyBase(SQLModel):
name: Optional[str] = Field(index=True, nullable=True, default=None)
created_at: datetime = Field(default_factory=datetime.utcnow)
last_used_at: Optional[datetime] = Field(default=None, nullable=True)
created_at: datetime = Field(sa_column=Column(DateTime(timezone=True), server_default=func.now()))
last_used_at: Optional[datetime] = Field(sa_column=Column(DateTime(timezone=True)))
total_uses: int = Field(default=0)
is_active: bool = Field(default=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import TYPE_CHECKING, Optional
from uuid import UUID, uuid4

from sqlmodel import Field, Relationship, SQLModel
from sqlmodel import Field, Relationship, SQLModel, Column, func, DateTime

from langflow.services.database.models.credential.schema import CredentialType

Expand All @@ -19,8 +19,11 @@ class CredentialBase(SQLModel):
class Credential(CredentialBase, table=True):
id: Optional[UUID] = Field(default_factory=uuid4, primary_key=True, description="Unique ID for the credential")
# name is unique per user
created_at: datetime = Field(default_factory=datetime.utcnow, description="Creation time of the credential")
updated_at: Optional[datetime] = Field(None, description="Last update time of the credential")
created_at: datetime = Field(
sa_column=Column(DateTime(timezone=True), server_default=func.now()),
description="Creation time of the credential",
)
updated_at: Optional[datetime] = Field(None,sa_column=Column(DateTime(timezone=True)), description="Last update time of the credential")
# foreign key to user table
user_id: UUID = Field(description="User ID associated with this credential", foreign_key="user.id")
user: "User" = Relationship(back_populates="credentials")
Expand Down

0 comments on commit e2172f4

Please sign in to comment.