diff --git a/.github/workflows/apiv2-test.yml b/.github/workflows/apiv2-test.yml index 3a1eb6ca5..a0ba5be31 100644 --- a/.github/workflows/apiv2-test.yml +++ b/.github/workflows/apiv2-test.yml @@ -16,6 +16,18 @@ jobs: name: "Run tests" steps: - uses: actions/checkout@v3 + - name: Install AWS CLI v2 + shell: bash + run: | + set -ue + set -o pipefail + URL="https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" + curl $URL -o /tmp/awscliv2.zip -v + unzip -q /tmp/awscliv2.zip -d /tmp + rm /tmp/awscliv2.zip + sudo /tmp/aws/install --update + rm -rf /tmp/aws/ + # Set up a local test env and run tests - name: Run tests run: | diff --git a/Makefile b/Makefile index 029e4d833..7cb788881 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ api-init: apiv2-init: docker compose --profile apiv2 up -d docker compose exec db sh -c 'echo create database cryoetv2 | psql postgres://postgres:postgres@127.0.0.1:5432/cryoet' || true - $(MAKE) -C apiv2 seed-moto + cd ./test_infra/; ./seed_moto.sh $(MAKE) -C apiv2 alembic-upgrade-head .PHONY: clean diff --git a/apiv2/database/models/tomogram_voxel_spacing.py b/apiv2/database/models/tomogram_voxel_spacing.py index 304e1b5f8..7e5c1f8b6 100644 --- a/apiv2/database/models/tomogram_voxel_spacing.py +++ b/apiv2/database/models/tomogram_voxel_spacing.py @@ -38,6 +38,7 @@ class TomogramVoxelSpacing(Base): back_populates="tomogram_voxel_spacing", uselist=True, foreign_keys="AnnotationFile.tomogram_voxel_spacing_id", + cascade="all, delete-orphan", ) run_id: Mapped[int] = mapped_column(Integer, ForeignKey("run.id"), nullable=True, index=True) run: Mapped["Run"] = relationship( diff --git a/apiv2/schema/schema.yaml b/apiv2/schema/schema.yaml index 8007224d9..7d7999689 100644 --- a/apiv2/schema/schema.yaml +++ b/apiv2/schema/schema.yaml @@ -2205,6 +2205,8 @@ classes: multivalued: true inverse: AnnotationFile.tomogram_voxel_spacing range: AnnotationFile + annotations: + cascade_delete: true run: name: run from_schema: cdp-dataset-config