https://github.com/nathanthorell/pg-snowfall-db
Basic PostgreSQL database to store snowfall data from NSIDC. Uses Flyway for migrations.
https://github.com/nathanthorell/pg-snowfall-db
flyway postgresql sqlfluff
Last synced: about 2 months ago
JSON representation
Basic PostgreSQL database to store snowfall data from NSIDC. Uses Flyway for migrations.
- Host: GitHub
- URL: https://github.com/nathanthorell/pg-snowfall-db
- Owner: nathanthorell
- License: gpl-2.0
- Created: 2024-01-17T03:11:20.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-21T18:22:09.000Z (over 1 year ago)
- Last Synced: 2025-01-21T19:29:56.387Z (over 1 year ago)
- Topics: flyway, postgresql, sqlfluff
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PostgreSQL Snowfall Database
Basic PostgreSQL database to store snowfall data from [NOAA NCEI](https://www.ncei.noaa.gov/). Uses Flyway for migrations.
## Local Environment Configuration
Example of expected environment variables:
```bash
PG_HOST=localhost
PG_PORT=5432
PG_DB=snowfall
FLYWAY_USER=postgres
FLYWAY_PASSWORD=YOUR_SECRET_PASSWORD_HERE
```
## Create Local PostgreSQL Database
- For local migration testing you will need a local Postgres DB instance
- Docker Example:
```bash
docker run --name postgresdb -e POSTGRES_PASSWORD=YOUR_SECRET_PASSWORD_HERE -d -p 5432:5432 -v postgres_data:/var/lib/postgresql/data postgres:16
```
- Flyway requires a database before it can connect. To speed up this process for development iteration, I've added `create_pg_db.zsh` which parses the flyway.conf file and pulls the server connection information. It then connects and checks if the database exists, if so it drops the database then creates a new empty one.
## CI Migrations
Migrations are structured for use with FlywayDB
- For local testing, you will need FlywayDB Community Edition installed
- [Download FlywayDB](https://flywaydb.org/download/community)
- For local migration testing edit the `flyway.conf` file in this project's root directory with your local connection configuration.
- Then run `flyway migrate`