doppler is a simple Python tool for managing changes to your database.
- doppler is ORM-agnostic
- uses raw-SQL scripts as migrations
- DBA's can write the scripts, no python knowledge required
- gives you complete control over your schema
Installation
Install using pip:
pip install -e git://github.com/nickgartmann/doppler.git
or add to your requirements.txt file
-e git://github.com/nickgartmann/doppler.git
Setup
In order for doppler to work, you must have a migrations folder located somewhere in your project directory. Doppler will recurse through your directory structure until it finds a folder named migrations. Otherwise, you can specify a directory while running the cli.
Usage
Generate Migrations
The doppler generate command creates two sql files. The first is run when migrating the database up, the second is for migrating down. Thus, the contents of the *.down.sql file should do the undo the effect of the *.up.sql file.
doppler generate < migration name >
Example:
doppler generate initial-schema
Outputs:
Created: ./migrations/001.initial-schema.up.sql
Created: ./migrations/001.initial-schema.down.sql
Apply Migrations
doppler migrate up
doppler migrate down
Options
Folder
Use this to specify which folder you keep your migrations in, for if you dont want to use the migrations folder convention.
-f, --folder /path/to/migration/folder
Database
Use this to specify the connection information to your database. This can also be stored in the DATABASE_URL environment variable (standard configuration for heroku.) This should be in a standard database connection url format:
database-type://username:password@host:port/database
To include the option:
-db, --database < database url >
Requirements:
- Python
Comments not found