Skip to content

Add support for deleting old/unused modules/versions #112

@dylan-bourque

Description

@dylan-bourque

TItle

We should have support for deleting old/unused modules so that the database doesn't grow without bound

Description

Currently, there is no way to remove modules/versions from the database, which means the backing PostgreSQL database will grow infinitely. There should be an API endpoint, and associated CLI sub-command, for deleting, preferably with an "if older than" watermark parameter.

An initial proposal for the CLI command:

perseus delete [module glob pattern] --prerelease-only --if-older-than [date/time]

The module pattern would be a glob string like example.com/foo/* specifying which modules to delete. The optional --prerelease-only flag would indicate to only delete pre-release versions and --if-older-than, if specified, would only delete module versions that were added before that date.

We should probably also consider:

  • a --dry-run parameter that outputs information about what would have been removed without actually doing so.
  • another pattern for matching versions to be deleted

Additional Info

The database foreign keys are set up for ON DELETE CASCADE but we would need to add an additional column to capture and store a creation date so that we have something to compare the --if-older-than value against.

The anticipated use case is something like a cron job that trims "old" and unused pre-release versions by running perseus delete github.com/someorg/* --prerelease --if-older-than $(date -v '90 days ago'). We do not want to add an internal "job scheduler" to the Perseus service, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions