diff --git a/.github/workflows/image-publish.yml b/.github/workflows/image-publish.yml index c4117d4e..a4f8cd8a 100644 --- a/.github/workflows/image-publish.yml +++ b/.github/workflows/image-publish.yml @@ -89,7 +89,7 @@ jobs: cache-to: type=gha,mode=max build-args: | LATEST_RELEASE=${{ env.LATEST_RELEASE }} - CODEGATE_VERSION=${{ steps.version-string.outputs.tag }} + CODEGATE_VERSION=${{ github.ref_name }} - name: Capture Image Digest id: image-digest run: | diff --git a/Makefile b/Makefile index 157d01bf..0a0999ba 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,9 @@ build: clean test poetry build image-build: + @echo "Fetching tags to get right version number..." + @git fetch -t + @echo "Building container..." DOCKER_BUILDKIT=1 $(CONTAINER_BUILD) \ -f Dockerfile \ --build-arg LATEST_RELEASE=$(shell curl -s "https://api.github.com/repos/stacklok/codegate-ui/releases/latest" | grep '"zipball_url":' | cut -d '"' -f 4) \ diff --git a/migrations/env.py b/migrations/env.py index 0729ead0..330a20e0 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -35,6 +35,7 @@ def run_migrations_offline() -> None: target_metadata=target_metadata, literal_binds=True, dialect_opts={"paramstyle": "named"}, + transactional_ddl=True, ) with context.begin_transaction(): diff --git a/migrations/versions/2025_01_21_0820-4dec3e456c9e_add_on_delete_cascade.py b/migrations/versions/2025_01_21_0820-4dec3e456c9e_add_on_delete_cascade.py index 5aaa4467..99a98404 100644 --- a/migrations/versions/2025_01_21_0820-4dec3e456c9e_add_on_delete_cascade.py +++ b/migrations/versions/2025_01_21_0820-4dec3e456c9e_add_on_delete_cascade.py @@ -21,6 +21,7 @@ def upgrade() -> None: # To add ON DELETE CASCADE to the foreign key constraint, we need to # rename the table, create a new table with the constraint, and copy # the data over. + op.execute("DROP TABLE IF EXISTS _prompts_old;") op.execute("ALTER TABLE prompts RENAME TO _prompts_old;") op.execute( """ @@ -39,6 +40,7 @@ def upgrade() -> None: op.execute("DROP TABLE _prompts_old;") # Doing the same for the sessions table + op.execute("DROP TABLE IF EXISTS _sessions_old;") op.execute("ALTER TABLE sessions RENAME TO _sessions_old;") op.execute( """ @@ -54,6 +56,7 @@ def upgrade() -> None: op.execute("DROP TABLE _sessions_old;") # Doing the same for the output table + op.execute("DROP TABLE IF EXISTS _outputs_old;") op.execute("ALTER TABLE outputs RENAME TO _outputs_old;") op.execute( """ @@ -70,6 +73,7 @@ def upgrade() -> None: op.execute("DROP TABLE _outputs_old;") # Doing the same for the alerts table + op.execute("DROP TABLE IF EXISTS _alerts_old;") op.execute("ALTER TABLE alerts RENAME TO _alerts_old;") op.execute( """ @@ -89,7 +93,7 @@ def upgrade() -> None: op.execute("DROP TABLE _alerts_old;") # Dropping unused table - op.execute("DROP TABLE settings;") + op.execute("DROP TABLE IF EXISTS settings;") # Create indexes for foreign keys op.execute("CREATE INDEX idx_outputs_prompt_id ON outputs(prompt_id);")