This project uses Flyway to manage PostgreSQL database migrations for handling Common Vulnerabilities and Exposures (CVE) data and builds docker image.
/migrations
: Contains SQL scripts for database schema and updates.Dockerfile
: Defines the Docker image for running Flyway migrations.flyway.conf
: Configuration file for database connection and migration settings.
- Schema:
cve
- Table:
CVE
id
: Unique CVE identifierdatatype
: Data typedataversion
: Data versioncve_metadata
: JSONB column for CVE metadatacontainers
: JSONB column for container info
- Two GIN indexes are created on the JSONB columns for better query performance.
Set the following variables:
DB_HOST
: PostgreSQL hostDB_PORT
: Database portDB_NAME
: Database nameDB_USER
: Database userDB_PASSWORD
: User passwordDB_SCHEMA
: Schema name (cve)
The flyway.conf
file includes database connection details and migration script locations.
- Build the Docker Image:
docker build -t cve-migration .
To run the migrations, follow these steps:
- Build the Docker Image: Use the provided Dockerfile to create a Docker image for the migration process.
docker build -t cve-migration .
- Run the Docker Container: Execute the Docker container with the necessary environment variables. You can use an
.env
file to manage these variables conveniently.
docker run --env-file .env cve-migration
Make sure your .env
file contains all the required environment variables.
If you would like to contribute to this project.
This project is licensed under the [MIT License].