Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update data connectors migrations #443

Merged

Conversation

leafty
Copy link
Member

@leafty leafty commented Oct 7, 2024

Fixes two issues with the migrations for data connectors:

  1. The migrations cannot be rolled back after creating a data connector. This was caused by leftover entries in the entity_slugs table.
  2. The entity slug constraint was not created. The change was not picked up by Alembic; it seems Alembic can only handle CheckConstraint creation together with table creation, but not new constraints on an existing table, updates to them, or removing them from a table.

Manually tested:

  1. Create data connectors with the deployment at HEAD
  2. Connect to a data-service pod and run
    /app/env/bin/python3 -m alembic -c /app/env/lib/python3.12/site-packages/renku_data_services/migrations/alembic.ini --name common downgrade 726d5d0e1f28
  3. Check that the current revision is 726d5d0e1f28, that is before data connectors
  4. Re-apply migrations

Note that this series of actions would fail prior to this fix.

/deploy #notest

@RenkuBot
Copy link
Contributor

RenkuBot commented Oct 7, 2024

You can access the deployment of this PR at https://renku-ci-ds-443.dev.renku.ch

@leafty leafty marked this pull request as ready for review October 7, 2024 12:19
@leafty leafty requested a review from a team as a code owner October 7, 2024 12:19
@@ -135,6 +141,8 @@ def downgrade() -> None:
schema="storage",
)
op.drop_table("data_connector_secrets", schema="storage")
op.drop_constraint("either_project_id_or_data_connector_id_is_set", "entity_slugs", schema="common", type_="check")
op.execute("""DELETE FROM common.entity_slugs WHERE entity_slugs.data_connector_id IS NOT NULL""")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: I don't think this needs to be triple quoted.

@leafty leafty merged commit d8c7b05 into leafty/build-data-connectors Oct 7, 2024
20 checks passed
@leafty leafty deleted the leafty/feat-namespaced-data-connectors-7 branch October 7, 2024 13:16
@RenkuBot
Copy link
Contributor

RenkuBot commented Oct 7, 2024

Tearing down the temporary RenkuLab deplyoment for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants