Skip to content

Commit

Permalink
🗃️(api) squash cache entry migrations
Browse files Browse the repository at this point in the history
- Renamed `cache` table to `cacheentry` in the initial migration
- Added `since`, `until` and `created_at` fields
- Made `created_at` nullable
  • Loading branch information
wilbrdt committed Nov 19, 2024
1 parent 0b647ef commit 379275d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 120 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Init
"""introduce cacheentry
Revision ID: ecc3caa6bbbd
Revision ID: 05e3da68582b
Revises:
Create Date: 2023-08-24 16:32:53.984506
Expand All @@ -14,7 +14,7 @@


# revision identifiers, used by Alembic.
revision: str = "ecc3caa6bbbd"
revision: str = "05e3da68582b"
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
Expand All @@ -23,18 +23,21 @@
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"cache",
"cacheentry",
sa.Column("value", sa.JSON(), nullable=True),
sa.Column("id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
sa.Column("key", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=False),
sa.Column("since", sa.DateTime(timezone=True), nullable=True),
sa.Column("until", sa.DateTime(timezone=True), nullable=True),
sa.Column("created_at", sa.DateTime(timezone=True), nullable=True),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(op.f("ix_cache_key"), "cache", ["key"], unique=False)
op.create_index(op.f("ix_cacheentry_key"), "cacheentry", ["key"], unique=False)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_cache_key"), table_name="cache")
op.drop_table("cache")
op.drop_index(op.f("ix_cacheentry_key"), table_name="cacheentry")
op.drop_table("cacheentry")
# ### end Alembic commands ###

0 comments on commit 379275d

Please sign in to comment.