diff --git a/CHANGELOG.md b/CHANGELOG.md index a770df3..3886930 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to Wutta-Continuum will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.3.2 (2026-02-01) + +### Fix + +- add compose indexes to version tables, per upstream changes + ## v0.3.1 (2025-12-31) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 4498c9b..382e813 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "Wutta-Continuum" -version = "0.3.1" +version = "0.3.2" description = "SQLAlchemy-Continuum versioning for Wutta Framework" readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@wuttaproject.org"}] diff --git a/src/wutta_continuum/db/alembic/versions/f51330d1fa4d_add_composite_indexes_per_upstream_.py b/src/wutta_continuum/db/alembic/versions/f51330d1fa4d_add_composite_indexes_per_upstream_.py new file mode 100644 index 0000000..5b39ce2 --- /dev/null +++ b/src/wutta_continuum/db/alembic/versions/f51330d1fa4d_add_composite_indexes_per_upstream_.py @@ -0,0 +1,106 @@ +"""add composite indexes per upstream changes + +Revision ID: f51330d1fa4d +Revises: 46fb4711411d +Create Date: 2026-02-01 18:24:25.713961 + +""" + +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa +import wuttjamaican.db.util + + +# revision identifiers, used by Alembic. +revision: str = "f51330d1fa4d" +down_revision: Union[str, None] = "46fb4711411d" +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + + # *_version + op.create_index( + "ix_permission_version_pk_transaction_id", + "permission_version", + ["role_uuid", "permission", sa.literal_column("transaction_id DESC")], + unique=False, + ) + op.create_index( + "ix_permission_version_pk_validity", + "permission_version", + ["role_uuid", "permission", "transaction_id", "end_transaction_id"], + unique=False, + ) + op.create_index( + "ix_person_version_pk_transaction_id", + "person_version", + ["uuid", sa.literal_column("transaction_id DESC")], + unique=False, + ) + op.create_index( + "ix_person_version_pk_validity", + "person_version", + ["uuid", "transaction_id", "end_transaction_id"], + unique=False, + ) + op.create_index( + "ix_role_version_pk_transaction_id", + "role_version", + ["uuid", sa.literal_column("transaction_id DESC")], + unique=False, + ) + op.create_index( + "ix_role_version_pk_validity", + "role_version", + ["uuid", "transaction_id", "end_transaction_id"], + unique=False, + ) + op.create_index( + "ix_user_version_pk_transaction_id", + "user_version", + ["uuid", sa.literal_column("transaction_id DESC")], + unique=False, + ) + op.create_index( + "ix_user_version_pk_validity", + "user_version", + ["uuid", "transaction_id", "end_transaction_id"], + unique=False, + ) + op.create_index( + "ix_user_x_role_version_pk_transaction_id", + "user_x_role_version", + ["uuid", sa.literal_column("transaction_id DESC")], + unique=False, + ) + op.create_index( + "ix_user_x_role_version_pk_validity", + "user_x_role_version", + ["uuid", "transaction_id", "end_transaction_id"], + unique=False, + ) + + +def downgrade() -> None: + + # *_version + op.drop_index( + "ix_user_x_role_version_pk_validity", table_name="user_x_role_version" + ) + op.drop_index( + "ix_user_x_role_version_pk_transaction_id", table_name="user_x_role_version" + ) + op.drop_index("ix_user_version_pk_validity", table_name="user_version") + op.drop_index("ix_user_version_pk_transaction_id", table_name="user_version") + op.drop_index("ix_role_version_pk_validity", table_name="role_version") + op.drop_index("ix_role_version_pk_transaction_id", table_name="role_version") + op.drop_index("ix_person_version_pk_validity", table_name="person_version") + op.drop_index("ix_person_version_pk_transaction_id", table_name="person_version") + op.drop_index("ix_permission_version_pk_validity", table_name="permission_version") + op.drop_index( + "ix_permission_version_pk_transaction_id", table_name="permission_version" + )