Page MenuHomePhabricator

[web-db] add metadata table operations
ClosedPublic

Authored by kamil on Mar 27 2023, 4:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 3, 8:02 AM
Unknown Object (File)
Wed, Apr 3, 8:02 AM
Unknown Object (File)
Wed, Apr 3, 8:02 AM
Unknown Object (File)
Wed, Apr 3, 8:02 AM
Unknown Object (File)
Wed, Apr 3, 8:01 AM
Unknown Object (File)
Wed, Apr 3, 7:55 AM
Unknown Object (File)
Thu, Mar 28, 2:18 PM
Unknown Object (File)
Mar 8 2024, 6:55 PM
Subscribers

Details

Summary

Native version: link;
On the web (for now) we will need this to set current_user_id - to somehow connect database with user, to decide when we should clear sensitive data.

NOTE: D7121 is not landed yet, and even so, my local environment is the only place where this code was executed so adding this without migration.

Depends on D7154

Test Plan

run tests D7181

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Mar 27 2023, 5:02 AM
kamil added inline comments.
web/database/queries/metadata-queries.js
12 ↗(On Diff #24161)

native version: link

25 ↗(On Diff #24161)

native version: link

43 ↗(On Diff #24161)

native version: link

ashoat added inline comments.
web/database/queries/metadata-queries.js
9 ↗(On Diff #24161)

The question mark here means that either this is { name: string } or { name: string, data: string }, and that it CANNOT be { name: string, data: null } (for instance)

Other the other hand, if we said data: ?string, then it would be okay to be { name: string, data: null }, but NOT okay to be { name: string }

Are you sure we're using the right one?

27 ↗(On Diff #24161)

Nit: typically we give FROM metadata its own line

This revision is now accepted and ready to land.Mar 27 2023, 3:46 PM

fix type and query format

web/database/queries/metadata-queries.js
9 ↗(On Diff #24161)

I can not remember why the question mark is here so probably it's just a mistake.
Based on the table definition in SQL the correct one is:

type Metadata = {
  name: string,
  data: string,
}
This revision was automatically updated to reflect the committed changes.