Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database support #3

Open
robballou opened this issue Feb 24, 2015 · 0 comments
Open

Database support #3

robballou opened this issue Feb 24, 2015 · 0 comments

Comments

@robballou
Copy link
Owner

The original rotatelib supports rotating database tables that have date-based names. This would need a means to let users pass DB credentials and interface with a database via JS. Perhaps something like this:

var rotatelib = require('js-rotatelib');

var params = {
  before: "-7 days",
  database: {
    type: 'mysql',
    user: 'root',
    password: 'secret',
    name: 'example'
  }
};

rotatelib
  .list(params)
  .then(function(items) {
    rotatelib.removeItems(items, params)
      .then(function() {
        var plural = items.length !== 1 ? 's' : '';
        console.log('Removed ' + items.length + ' table' + plural);
      });
  });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant