npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

db-local-sync

v1.0.6

Published

DB-Local-Sync lets your local database always in sync with its identical remote database, for development purposes

Downloads

34

Readme

DB-Local-Sync

DB-Local-Sync

What is it?

DB-Local-Sync is a very small nodejs package that keeps your local database in sync with a remote database, for development purposes.

Limitations

Right now, DB-Local-Sync only works with MySQL databases. But I'm already working on MongoDB support.

MySQL strict mode

If you are having some problems while updating your local database, this may be due to the MySQL strict mode.

Just add this to your dbconfig.json and DB-Local-Sync will temporarily disable strict mode.

{
  "strictMode": false, // disable sql strict mode
}

How does it work?

You simply set the configuration file with the local and remote databases and a time interval. It will check every N minutes if there are changes and you will get a notification to update it. That's it.

Install

Install it globally so you can run on your projects:

$ npm install -g db-local-sync

How to use it?

On your working directory, create a dbconfig.json file, like this:

{
  "strictMode": false, // disable sql strict mode
  "interval": 5, // time interval to check for new changes (in minutes)
  
  "local": { // local database settings
    "host": "localhost",
    "user": "root",
    "password": "password",
    "database": "local_db",
    "port": 3306 // default is 3306
  },
  
  "remote": { // remote database settings
    "host": "mysql://remotedatabase",
    "user": "root",
    "password": "password",
    "database": "remote_db",
    "port": 3306 // default is 3306
  }
}

And run this command from the working directory:

$ db-local-sync

You will get something like this:

[DB-Local-Sync] Watching for changes of remote_db in mysql://remotedatabase
[DB-Local-Sync] Database has not changed since last time...

Go on and make some changes on your remote database. After the time interval you've set on the dbconfig.json has passed, you'll get this to pop up on your screen:

Screenshot

Click on it and you're going to sync your local database. You'll get another pop up message saying

Booya! Databases are synced!

If you check your database, you'll see that there's a backup for your local database (in case you run into any problems, you can easily revert) and the changes from the remote database are there on your local database.

TODO

  • MongoDB support
  • Create tests

Contribute

Any help is more than welcome. If you've found any bug, have ideas for new features or want to help in any way, please get in touch!