Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.
This repository was archived by the owner on Nov 28, 2024. It is now read-only.

Change from MongoDB to PostgreSQL #601

@Floppy

Description

@Floppy

The version of MongoDB we're using is old and being retired from MongoDB Atlas on April 30th 2021, and we're in dependency hell trying to update it. Given the changes to the app to remove stored CSV data (from ages back), we don't really need MongoDB any more, so we can change to something more standard, i.e. PostgreSQL.

I propose to do this in a series of discrete steps, each of which will be deployed live and verified as working as they are completed.

  1. Move MongoDB models into a Legacy namespace. Create non-ActiveRecord models in the global namespace which transparently delegate everything to the legacy variants. Tests should not be changed. Move mongooid models to legacy #602, Change everything to use legacy models explicitly #603
  2. Move non-DB methods out of Legacy models into concerns and service objects, leaving legacy models as bare Mongoid config only.
  3. Create new ActiveRecord models, with a PostgreSQL DB and schema
  4. Create a task to copy all data from Legacy models into ActiveRecord ones. Run and verify correctness of migrated data
  5. Change Delayed::Job to use postgres, not mongodb
  6. Remove all legacy model delegation from new models, thus making the app use the new AR-backed data.
  7. Remove legacy models and MongoDB-related dependencies
  8. Retire MongoDB Atlas server

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions