peewee-moves

A simple and flexible migration manager for Peewee ORM.

Build Status Code Coverage Version Downloads Documentation

Requirements

  • python >= 3.4, <= 3.6
  • peewee >= 3.0.0

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.

License

The MIT License (MIT)

Copyright (c) 2016 Tim Shaffer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.