Skip to content
This repository was archived by the owner on Feb 20, 2022. It is now read-only.

Easily stash away working copies of your local database to pull from and use later with your flask or django apps

Notifications You must be signed in to change notification settings

DCalliet/Database-State-Machine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Database-State-Machine

======================

This tool is for individuals who are constantly going back and forth between versions of their database, and thus have to run code to re-migrate it, apply the migrations, and eventually wait as some script repopulates their database with data.

Intended for your local POSTGRES (more later hopefully!)database use, please don't try this on a production instance

Inspired by the concept of git stash, you can stash away a current state of your database. This allows you to switch branches, do whatever you want to your database, and easily restore it to any saved state!

##Setup

In the settings.py file:

Set 'db.NAME' to the name of your working database (Please make sure it exists!)

Set 'db.USER' to an owner of your working database (We must have full permissions!)

If the default 'db.STATE_TABLE_NAME' and 'db.TEMP_DATABASE_NAME' will conflict with an existing table or database (respectively) feel free to change those names!

##Usage

  • db_management.py help
  • db_management.py save_db gives your working directory a state to be saved as when swapped for a load.
  • db_management.py stash_db stashes a copy of your database with a state we use to identify it
  • db_management.py load_db finds the db state, and loads it as your working db. Your current one has the option to get stashed away.
  • db_management.py delete_state (default:all) - allow user to delete a single or all state db's (can remove state from working but not delete it)

About

Easily stash away working copies of your local database to pull from and use later with your flask or django apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages