mozilla / mozilla/blurts-server

src/db/tables/featureFlags.ts uses `modified_at` whereas other tables use `updated_at`

Open
#3,473 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

jira-synced
Dominant language
Fluent
Stars
942
Forks
315
Avg merge
1d 16h
Merged PRs (30d)
19

Description

Pretty tiny nit, but… was randomly trying to grep for knex+.update() statements without an updated_at column, but came across something possibly odd.

git grep -P -A6 "\.update\(" | grep -Eo "\s[a-z_]+_at: knex.fn.now\(\)" | sort | uniq -c
   1  deleted_at: knex.fn.now()
   6  modified_at: knex.fn.now()
  18  updated_at: knex.fn.now()

Looks like the majority of .update() queries are using an updated_at column, it looks like featureFlags.ts might be an outlier w/ modified_at:

git grep -P -A6 "\.update\(" | grep -E "\s[a-z_]+_at: knex.fn.now\(\)" | sort | uniq -c
   1 src/db/tables/emailAddresses.js-            updated_at: knex.fn.now()
   2 src/db/tables/emailAddresses.js-      updated_at: knex.fn.now()
   1 src/db/tables/emailAddresses.js-      updated_at: knex.fn.now(),
   1 src/db/tables/featureFlags.ts-      deleted_at: knex.fn.now(),
   6 src/db/tables/featureFlags.ts-      modified_at: knex.fn.now(),
   1 src/db/tables/onerep_scans.ts-      updated_at: knex.fn.now(),
   2 src/db/tables/onerep_scans.ts-    updated_at: knex.fn.now(),
   2 src/db/tables/subscribers.js-        updated_at: knex.fn.now(),
   9 src/db/tables/subscribers.js-      updated_at: knex.fn.now(),

Conversely, we can grep by knex.fn.now():

git grep -Po "\b[a-z_]+: knex.fn.now\(\)" src/db/tables | grep -v "ts-ignore" | sort | uniq -c
   4 src/db/tables/emailAddresses.js:updated_at: knex.fn.now()
   1 src/db/tables/featureFlags.ts:deleted_at: knex.fn.now()
   6 src/db/tables/featureFlags.ts:modified_at: knex.fn.now()
   1 src/db/tables/onerep_profiles.ts:created_at: knex.fn.now()
   2 src/db/tables/onerep_scans.ts:created_at: knex.fn.now()
   3 src/db/tables/onerep_scans.ts:updated_at: knex.fn.now()
  12 src/db/tables/subscribers.js:updated_at: knex.fn.now()

┆Issue is synchronized with this Jira Task

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/db/tables/featureFlags.ts and compare its knex update calls with the updated_at usage in src/db/tables/emailAddresses.js, src/db/tables/onerep_scans.ts, and src/db/tables/subscribers.js. Use the grep commands in the issue to verify the inconsistency and confirm whether feature flags should use the same timestamp column; done means the table's timestamp naming is consistent with the intended schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.