Skip to content

Add database integration with PostgreSQL and ActiveRecord#3

Open
GrimbiXcode wants to merge 7 commits into
mainfrom
feature/database-integration
Open

Add database integration with PostgreSQL and ActiveRecord#3
GrimbiXcode wants to merge 7 commits into
mainfrom
feature/database-integration

Conversation

@GrimbiXcode

Copy link
Copy Markdown
Owner

Changes

This PR adds database integration to ProductMiner, enabling the storage of product prices and metadata.

New Features

  • PostgreSQL Integration: Added pg and activerecord gems for database support
  • Database Models: Product and Price models to store product information and price history
  • Database Configuration: config/database.yml for environment-specific settings
  • Migration: Initial schema for products and prices tables
  • Enhanced Foreman: Now saves fetched prices to the database
  • Improved Error Handling: Added retries with exponential backoff for API calls
  • RSpec Tests: Added comprehensive tests for MigrosApi and Foreman

Files Changed

  • Added: config/database.yml, lib/product_miner/db.rb, lib/product_miner/models/product.rb, lib/product_miner/models/price.rb, db/migrate/20260603000000_create_products_and_prices.rb, spec/spec_helper.rb, spec/miners/migros_api_spec.rb, spec/foreman/foreman_spec.rb
  • Modified: Gemfile, lib/product_miner/foreman/foreman.rb, lib/product_miner/miners/migros_api.rb, lib/product_miner.rb, Rakefile, .gitignore

How to Use

  1. Setup PostgreSQL:
    docker run --name pm-postgres -e POSTGRES_PASSWORD=your_password -p 5432:5432 -d postgres

  2. Create databases:
    createdb product_miner
    createdb product_miner_test

  3. Run migrations:
    rake db:setup

  4. Install jobs:
    rake jobs:install

  5. Run tests:
    rspec

Next Steps

  • Add configuration file for multiple products
  • Implement product management CLI
  • Add more miners (e.g., Coop, Digitec)
  • Create web interface (Rails)

Closes #1 (First Miner - reduced features)

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.

1 participant