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: adding SQL migration for making device_token UNIQUE #202

Merged
merged 3 commits into from
Sep 26, 2023
Merged

fix: adding SQL migration for making device_token UNIQUE #202

merged 3 commits into from
Sep 26, 2023

Conversation

geekbrother
Copy link
Contributor

@geekbrother geekbrother commented Sep 18, 2023

Description

This PR is a follow-up for #196 with the following SQL migration changes wrapped into the transaction by adding the new 1695024779_add-unique-device-tokens migration file:

  1. Clear the clients table with duplicate device tokens keeping the latest one,
  2. Adding UNIQUE constraint to the device_token column in the client's table.

Resolves #201

How Has This Been Tested?

Apply or cherry-pick changes from #211 and #213.
When running the functional tests migrations are applied that's why we can rely on our upsert functional tests from #196 to test that:

  • SQL migration in the new file is correct and runs successfully,
  • Changes from the SQL migration don't break the current logic.

To run functional tests start the PostgreSQL instances:

docker run \
  -p 5432:5432 \
  -e POSTGRES_HOST_AUTH_METHOD=trust \
  --name echo-server-pg \
  -d postgres

docker run \
  -p 5433:5432 \
  -e POSTGRES_HOST_AUTH_METHOD=trust \
  --name echo-server-tenant-pg \
  -d postgres

Call tests:

cargo t --features functional_tests

The expected behavior tests should pass.

Merging policy and dependency

This PR depends on and should be merged after #213

Due Diligence

  • Breaking change
  • Requires a documentation update
  • Requires a e2e/integration test update

@geekbrother geekbrother self-assigned this Sep 18, 2023
@geekbrother geekbrother mentioned this pull request Sep 18, 2023
3 tasks
@geekbrother geekbrother changed the title adding SQL migration for making device_token UNIQUE fix: adding SQL migration for making device_token UNIQUE Sep 18, 2023
@geekbrother
Copy link
Contributor Author

Updated the migration filename (increased timestamp) to make it applied after #211

@geekbrother geekbrother merged commit 7b761b3 into WalletConnect:main Sep 26, 2023
5 of 6 checks passed
@geekbrother geekbrother deleted the fix/add_migration_for_unique_tokens branch October 1, 2023 15:17
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.

fix: adding SQL migration file to make device_token unique
3 participants