Skip to content

Commit

Permalink
Add PostgreSQL database
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorLop committed Feb 3, 2024
1 parent 6babfa5 commit 7b23c91
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target/
Dockerfile
data/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# will have compiled files and executables
debug/
target/
data/
.envrc
.env

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ rstest = "0.18.2"
thiserror = "1.0.56"
axum = "0.7.3"
tokio = { version = "1.35.1", features = ["macros", "rt-multi-thread"] }
sqlx = { version = "0.7.3", features = ["tls-rustls", "runtime-tokio", "postgres"] }

[dev-dependencies]
pretty_assertions = "1.4.0"
Expand Down
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,16 @@ services:
image: fundsimulatorrs
ports:
- "3000:3000"
postgres:
image: postgres:16
ports:
- "5432:5432"
volumes:
- db-data:/var/lib/postgresql/data
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}

volumes:
db-data:
5 changes: 5 additions & 0 deletions migrations/20240203114703_create_real_distributions_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- Add migration script here
CREATE TABLE real_distributions(
name TEXT PRIMARY KEY,
data JSONB NOT NULL
);

0 comments on commit 7b23c91

Please sign in to comment.