Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage backend accounts in postgres #1091

Open
9 tasks
malteish opened this issue Jul 15, 2024 · 3 comments
Open
9 tasks

Manage backend accounts in postgres #1091

malteish opened this issue Jul 15, 2024 · 3 comments
Assignees

Comments

@malteish
Copy link
Collaborator

malteish commented Jul 15, 2024

#907 revealed that redis is only ever used for Session creation in the backend, where Session actually refers to an account. As the prisma model already defines an Account, we decided to remove redis and use the existing prisma Account model instead.

These fields exist in Session, if they are not crossed out they should be migrated to Account:

  • account: string; -> id
  • signedUserProfile: SignedUserProfile; -> must be read from resolver
  • token: string; -> deprecated since jwt
  • publicMessageHeadUri?: string; -> not used anywhere
  • createdAt: number; -> keeping this for future reference
  • socketId?: string; -> deprecated since socket manager
  • challenge?: string; deprecated since jwt
  • profileExtension: ProfileExtension; -> not used in backend
  • spamFilterRules?: unknown; -> spam filter does not exist yet, add field if necessary
@malteish
Copy link
Collaborator Author

migration plan:

  1. add createdAt field to Account model, populate with now as default
  2. replace all getSession (old) or getAccount (new) calls in backend with checkAccountExists that uses prisma as data source
  3. test on testing
  4. add manual migration that adds accounts in postgres for all sessions in redis
  5. test on staging

@malteish malteish changed the title Remove redis from bakend Remove redis from backend Aug 6, 2024
@malteish
Copy link
Collaborator Author

malteish commented Aug 6, 2024

In the backend, redis is only used to store the "Session". Todo:

  • create a table "account" in postgres that can be queried to know if an ens name has signed up with the backend yet
  • populate this table from redis through some scripts
  • change getSession to use this new postgres datasource
  • remove redis from backend

Moved this info here and closed #1089

@malteish
Copy link
Collaborator Author

malteish commented Aug 6, 2024

Estimate: 9 days (3 remaining)

@malteish malteish self-assigned this Aug 6, 2024
@malteish malteish changed the title Remove redis from backend Manage backend accounts in postgres Aug 15, 2024
This was referenced Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant