Page MenuHomePhabricator

[web-db] add metadata table operations
ClosedPublic

Authored by kamil on Mar 27 2023, 4:03 AM.
Tags
None
Referenced Files
F3375940: D7180.diff
Tue, Nov 26, 9:31 PM
Unknown Object (File)
Fri, Nov 15, 1:53 AM
Unknown Object (File)
Fri, Nov 15, 1:53 AM
Unknown Object (File)
Fri, Nov 8, 7:40 AM
Unknown Object (File)
Fri, Nov 8, 7:40 AM
Unknown Object (File)
Fri, Nov 8, 7:40 AM
Unknown Object (File)
Wed, Nov 6, 3:19 AM
Unknown Object (File)
Tue, Nov 5, 2:06 AM
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
Branch
db-web-7
Lint
No Lint Coverage
Unit
No Test Coverage

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.