Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change jobseekers email in db to Citext. Part 1.
To achieve a smooth non-case sensitive "search user by email", while keeping the indexed search instead of table scanning, the ideal solution seems to be using citext as the DB type, allowing postgresql to do the non-case sensitive matches. Changing the column type directly would lock the Jobseekers table. So, following "Online Migrations" guidance (and its useful helpers), we're doing the change in stages to avoid causing service downtime. The first stages to be deployed are: 1 - Create a new email column of citext type that is kept in sync with email column using DB triggers. 2 - Backfill this column for all the existing data. After deploying and testing this, we will follow up with copying the constraints, indexes, foreign keys, etc and swapping the columns. Once that is deployed we will remove the copy trigger and the old column. Reference: https://github.com/fatkodima/online_migrations?tab=readme-ov-file#bullettrain_side-concrete-steps-for-active-record
- Loading branch information