Simple and flexible migration manager for Peewee ORM.
Project description
A simple and flexible migration manager for Peewee ORM.
Requirements
python >= 3.3
peewee >= 2.8.2
Warning
This package does not yet work with peewee 3. I’m working on it. Feel free to help out with pull requests if you want.
Installation
This package can be installed using pip:
pip install peewee-moves
Usage
Here’s a quick teaser of what you can do with peewee-moves:
$ export FLASK_APP=myflaskapp
$ flask db create app.models.Category
INFO: created migration 0001_create_table_category
$ flask db revision "do something"
INFO: created migration 0002_do_something
$ flask db upgrade
INFO: 0001_create_table_category: upgrade
INFO: 0002_do_something: upgrade
$ flask db downgrade
INFO: 0002_do_something: downgrade
$ flask db status
INFO: 0001_create_table_category: applied
INFO: 0002_do_something: pending
And if you’re curious, here’s what 0001_create_table_category.py looks like. A migration was automatically created based on the definition of the Category model.
def upgrade(migrator):
with migrator.create_table('category') as table:
table.primary_key('id')
table.integer('code', unique=True)
table.string('name', max_length=250)
def downgrade(migrator):
migrator.drop_table('category')
Documentation
Check out the Full Documentation for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
peewee-moves-1.7.3.tar.gz
(11.4 kB
view hashes)
Built Distribution
Close
Hashes for peewee_moves-1.7.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 542ef5c78c640aa10e1c6d6a8e96b891371876e756d42433e5312a72ac271572 |
|
MD5 | 964c435dede1935e2d3ac67ed0ef59b1 |
|
BLAKE2b-256 | 5be571d12a0630ca96ea2bbdf44815ed02fc2c8fd2ad1f19d3f17ce595c6c700 |