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

Add sql database and tables for user and session #4

Merged
merged 5 commits into from
Apr 24, 2024

Conversation

sdankel
Copy link
Member

@sdankel sdankel commented Apr 23, 2024

  • Adds a script, start_local_db.sh to start a local postgres docker container
  • Adds a .env file with the variables for local development (connecting to postgres)
    From what I can tell, these are the correct env variable names for the deployed environments as well. When deployed, the deployed environment variables will take precedence over the ones in .env so it should all work.
  • Adds diesel ORM along with 2 migrations to create the users and sessions tables
  • Adds a connection pool for the database to the rocker server
  • Runs the SQL migrations when the server starts up, using run_pending_migrations
  • Switches the login and session APIs to use the SQL tables rather than the in memory store
  • Adds integration tests for the operations writing/reading from postgres

Note: in order to get diesel working on my machine, I had to run brew install libpq. Following this issue, cargo correctly link the directory for libpq for mac arm (it's working for me now). diesel-rs/diesel#2211

@sdankel sdankel marked this pull request as ready for review April 23, 2024 23:52
@sdankel sdankel requested a review from a team April 23, 2024 23:52
Copy link
Member

@JoshuaBatty JoshuaBatty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice a clean. Will try and get postgres setup on my local machine so I can test these locally in the future.

@JoshuaBatty JoshuaBatty self-requested a review April 24, 2024 00:17
@sdankel sdankel merged commit e7056a2 into master Apr 24, 2024
9 checks passed
@sdankel sdankel deleted the sophie/user-session-db branch April 24, 2024 00:23
@sdankel sdankel restored the sophie/user-session-db branch May 2, 2024 01:48
@sdankel sdankel deleted the sophie/user-session-db branch May 8, 2024 15:40
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

Successfully merging this pull request may close these issues.

None yet

2 participants