Giter VIP home page Giter VIP logo

mix_db_cleanup's Introduction

MixDbCleanup

Mix Task to perform cleanup of Database using ecto 2.x

Installation

Add mix_db_cleanup to your list of dependencies in mix.exs:

def deps do
  [{:mix_db_cleanup, github: "techgaun/mix_db_cleanup"}]
end

Usage

The db.cleanup mix task can be used to cleanup the database table. The intended use was originally for cleaning up older data in devices_data in one of our rapidly growing table but can be used for any table. The mix task is known to work with ecto 1.x only.

$ mix help db.cleanup

                                 mix db.cleanup

The db.cleanup task deletes old rows from a table. By default, it deletes
data from events that are older than 7 days.

Examples

┃ mix db.cleanup
┃ mix db.cleanup -t devices -n 30

Command Line Options

  • --repo / -r - the repo to use (defaults to current app repo)
  • --table / -t - the table to cleanup
  • --num / -n - day count. data before (current date - n) will be deleted
  • --count / -c - number of first rows to delete (overrides day based deletion)

mix_db_cleanup's People

Contributors

techgaun avatar

Watchers

James Cloos avatar  avatar Clay Coffman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.