README.md in blind_index-2.0.0 vs README.md in blind_index-2.0.1
- old
+ new
@@ -58,14 +58,11 @@
```
Backfill existing records
```ruby
-User.unscoped.where(email_bidx: nil).find_each do |user|
- user.compute_email_bidx
- user.save(validate: false)
-end
+BlindIndex.backfill(User)
```
And query away
```ruby
@@ -113,14 +110,11 @@
```
Backfill existing records
```ruby
-User.unscoped.where(email_ci_bidx: nil).find_each do |user|
- user.compute_email_ci_bidx
- user.save(validate: false)
-end
+BlindIndex.backfill(User, columns: [:email_ci_bidx])
```
And query away
```ruby
@@ -166,14 +160,11 @@
```
This allows you to backfill records while still querying the unencrypted field.
```ruby
-User.unscoped.where(email_bidx: nil).find_each do |user|
- user.compute_migrated_email_bidx
- user.save(validate: false)
-end
+BlindIndex.backfill(User)
```
Once that completes, you can remove the `migrating` option.
## Key Rotation
@@ -194,13 +185,10 @@
```
This will keep the new column synced going forward. Next, backfill the data:
```ruby
-User.unscoped.where(email_bidx_v2: nil).find_each do |user|
- user.compute_rotated_email_bidx
- user.save(validate: false)
-end
+BlindIndex.backfill(User, columns: [:email_bidx_v2])
```
Then update your model
```ruby