Lightning.Credentials.DropOauthTokensValidator (Lightning v2.14.11-pre1)

View Source

Validates the DropOauthTokensTable migration.

This module validates that the migration which drops the oauth_tokens table and consolidates all credential data into credential_bodies has completed successfully.

What it validates

Schema Changes

  • oauth_tokens table is dropped
  • credentials.body column is removed
  • credentials.oauth_token_id column is removed
  • credentials.production column is removed

Data Integrity

  • All credentials have credential_bodies
  • All OAuth credentials have oauth_client_id set
  • OAuth credential_bodies contain valid token data:
    • access_token
    • refresh_token
    • token_type
    • scope or scopes
    • expires_in or expires_at
  • All root projects have env set to 'main'

Usage

# Before migration
Lightning.Credentials.DropOauthTokensValidator.validate_before()

# After migration
Lightning.Credentials.DropOauthTokensValidator.validate_after()

Or use the validation script:

mix run priv/repo/validate_drop_oauth_tokens_migration.exs before
mix run priv/repo/validate_drop_oauth_tokens_migration.exs after

Summary

Functions

validate_after()

validate_before()