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

One login integration migrations #10144

Merged
merged 1 commit into from
Dec 6, 2024
Merged

Conversation

CatalinVoineag
Copy link
Contributor

@CatalinVoineag CatalinVoineag commented Dec 4, 2024

Context

We want to allow our candidates to login into apply with one login. We also want to allow them to recover their account if their one login email is different from the candidate's email.

These are all the migrations we need for our one login integration, to allow a candidate to login or recover their account.

This is based on the one login spike

Changes proposed in this pull request

We need to allow the user to reclaim their account with any code valid in the last 1 hour for example. That's why AccountRecoveryRequest has_many AccountRecoveryRequestCodes

erDiagram
    Candidate ||--o{ OmniAuthLogin : has_one
    Candidate ||--o{ AccountRecoveryRequest : has_one
    Candidate {
      string email_address
    }
    AccountRecoveryRequest ||--o{ AccountRecoveryRequestCode : has_many
    OmniAuthLogin {
      string token
      string email_address
      id candidate_id
    }
    AccountRecoveryRequest {
      string previous_account_email_address
      id candidate
    }
    AccountRecoveryRequestCode {
      string hashed_code
      id account_recovery_request_id
      datetime created_at
    }
Loading

Guidance to review

Does it make sense?

Things to check

  • If the code removes any existing feature flags, a data migration has also been added to delete the entry from the database
  • This code does not rely on migrations in the same Pull Request
  • If this code includes a migration adding or changing columns, it also backfills existing records for consistency
  • If this code adds a column to the DB, decide whether it needs to be in analytics yml file or analytics blocklist
  • If this code adds a column that may include PII, the sanitise.sql script and 0025-protecting-personal-data-in-production-dump.md ADR have been updated.
  • API release notes have been updated if necessary
  • If it adds a significant user-facing change, is it documented in the CHANGELOG?
  • Required environment variables have been updated added to the Azure KeyVault
  • Inform data insights team due to database changes
  • Make sure all information from the Trello card is in here
  • Rebased main
  • Cleaned commit history
  • Tested by running locally
  • Add PR link to Trello card

@CatalinVoineag
Copy link
Contributor Author

@CatalinVoineag CatalinVoineag force-pushed the cv/one-login-data-migrations branch 2 times, most recently from 2dd5311 to 4874632 Compare December 4, 2024 15:00
@CatalinVoineag CatalinVoineag force-pushed the cv/one-login-data-migrations branch 2 times, most recently from 81aa5d3 to e5a5596 Compare December 4, 2024 15:09
@CatalinVoineag CatalinVoineag force-pushed the cv/one-login-data-migrations branch from e5a5596 to 1221503 Compare December 4, 2024 15:27
@CatalinVoineag CatalinVoineag force-pushed the cv/one-login-data-migrations branch from 1221503 to 8d32009 Compare December 4, 2024 15:49
@CatalinVoineag CatalinVoineag force-pushed the cv/one-login-data-migrations branch from 8d32009 to 6f7d451 Compare December 4, 2024 16:28
@CatalinVoineag CatalinVoineag force-pushed the cv/one-login-data-migrations branch from 6f7d451 to 86317ee Compare December 4, 2024 16:37
@CatalinVoineag CatalinVoineag force-pushed the cv/one-login-data-migrations branch from e472950 to 86317ee Compare December 5, 2024 10:31
@CatalinVoineag CatalinVoineag force-pushed the cv/one-login-data-migrations branch from 86317ee to 469743a Compare December 5, 2024 10:59
@CatalinVoineag CatalinVoineag requested a review from a team December 5, 2024 11:01
@CatalinVoineag CatalinVoineag marked this pull request as ready for review December 5, 2024 11:01
Copy link
Collaborator

@dcyoung-dev dcyoung-dev left a comment

Choose a reason for hiding this comment

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

We should split the migration, schema and analytics files into another PR which gets deployed first. Even though we're not using the code that relies on the migration in this instance, it's good practice.

These are all the migrations we need for our one login integration, to
allow a candidate to login or recover their account.
@CatalinVoineag
Copy link
Contributor Author

We should split the migration, schema and analytics files into another PR which gets deployed first. Even though we're not using the code that relies on the migration in this instance, it's good practice.

I don't think we can split models from migrations. DfE analytics will look for models that you created in migrations.

As long as the models being created are not called by views/controllers/apis/jobs we should be fine

@CatalinVoineag CatalinVoineag merged commit 30360f9 into main Dec 6, 2024
24 checks passed
@CatalinVoineag CatalinVoineag deleted the cv/one-login-data-migrations branch December 6, 2024 10:49
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