Skip to content

Add database columns for 7+30+60d Deploy Token expiry notifications

What does this MR do and why?

This MR adds database support for deploy token expiry notifications at multiple intervals:

  • Adds three new columns to the deploy_tokens table:

    • seven_days_notification_sent_at
    • thirty_days_notification_sent_at
    • sixty_days_notification_sent_at
  • Creates three new indices to optimize queries for finding tokens that need notifications:

    • For 7-day notifications: index_dts_on_expiring_at_seven_days_notification_sent_at
    • For 30-day notifications: index_dts_on_expiring_at_thirty_days_notification_sent_at
    • For 60-day notifications: index_dts_on_expiring_at_sixty_days_notification_sent_at

These changes will enable sending notifications to users when their deploy tokens are about to expire, helping them take timely action to prevent disruption of services using these tokens. This is the Part 1/3 MRs for this issue Send an e-mail notification to project owners for expiring deploy tokens.

A continutation of Adding the Mailer function for sending emails can be found at Adding a mailer functions to send e-mail notifications

How to set up and validate locally,

In your GDK environment

  1. Run DB Migrations: bundle exec rails db:migrate
  2. Open the rails console: bundle exec rails c
  3. Run DeployToken.column_names

As a result, all three columns names should reflect in the output.

Relates to #512197

Edited by Pratibha Gupta

Merge request reports

Loading