peewee-migrate


Namepeewee-migrate JSON
Version 1.12.2 PyPI version JSON
download
home_pagehttps://github.com/klen/peewee_migrate
SummarySupport for migrations in Peewee ORM
upload_time2023-08-07 11:40:04
maintainer
docs_urlNone
authorKirill Klenov
requires_python>=3.8,<4.0
licenseMIT
keywords peewee migrations orm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Peewee Migrate
##############

.. _description:

Peewee Migrate -- A simple migration engine for Peewee_ ORM

.. _badges:

.. image:: https://github.com/klen/peewee_migrate/workflows/tests/badge.svg
    :target: https://github.com/klen/peewee_migrate/actions/workflows/tests.yml
    :alt: Tests Status

.. image:: https://github.com/klen/peewee_migrate/workflows/release/badge.svg
    :target: https://github.com/klen/peewee_migrate/actions/workflows/release.yml
    :alt: Build Status

.. image:: https://img.shields.io/pypi/v/peewee-migrate
    :target: https://pypi.org/project/peewee-migrate/
    :alt: PYPI Version

.. image:: https://img.shields.io/pypi/pyversions/peewee-migrate
    :target: https://pypi.org/project/peewee-migrate/
    :alt: Python Versions

.. _contents:

.. contents::

.. _requirements:

Requirements
=============

- peewee >= 3.8

Dependency Note
---------------

- For ``Peewee<3.0`` please use ``Peewee-Migrate==0.14.0``
- For ``Python 3.0-3.6`` please use ``Peewee-Migrate==1.1.6``
- For ``Python 3.7`` please use ``Peewee-Migrate==1.6.6``

.. _installation:

Installation
=============

**Peewee Migrate** should be installed using pip: ::

    pip install peewee-migrate

.. _usage:

Usage
=====

Do you want Flask_ integration? Look at Flask-PW_.

From shell
----------

Getting help: ::

    $ pw_migrate --help

    Usage: pw_migrate [OPTIONS] COMMAND [ARGS]...

    Options:
        --help  Show this message and exit.

    Commands:
        create   Create migration.
        migrate  Run migrations.
        rollback Rollback migration.

Create migration: ::

    $ pw_migrate create --help

    Usage: pw_migrate create [OPTIONS] NAME

        Create migration.

    Options:
        --auto                  FLAG  Scan sources and create db migrations automatically. Supports autodiscovery.
        --auto-source           TEXT  Set to python module path for changes autoscan (e.g. 'package.models'). Current directory will be recursively scanned by default.
        --database              TEXT  Database connection
        --directory             TEXT  Directory where migrations are stored
        -v, --verbose
        --help                        Show this message and exit.

Run migrations: ::

    $ pw_migrate migrate --help

    Usage: pw_migrate migrate [OPTIONS]

        Run migrations.

    Options:
        --name TEXT       Select migration
        --database TEXT   Database connection
        --directory TEXT  Directory where migrations are stored
        -v, --verbose
        --help            Show this message and exit.

Rollback migrations: ::

    $ pw_migrate rollback --help

    Usage: pw_migrate rollback [OPTIONS]

        Rollback a migration with given steps --count of last migrations as integer number

    Options:
        --count INTEGER   Number of last migrations to be rolled back.Ignored in
                            case of non-empty name

        --database TEXT   Database connection
        --directory TEXT  Directory where migrations are stored
        -v, --verbose
        --help            Show this message and exit.


From python
-----------

.. code-block:: python

    from peewee_migrate import Router
    from peewee import SqliteDatabase

    router = Router(SqliteDatabase('test.db'))

    # Create migration
    router.create('migration_name')

    # Run migration/migrations
    router.run('migration_name')

    # Run all unapplied migrations
    router.run()

Migration files
---------------

By default, migration files are looked up in ``os.getcwd()/migrations`` directory, but custom directory can be given.

Migration files are sorted and applied in ascending order per their filename.

Each migration file must specify ``migrate()`` function and may specify ``rollback()`` function

.. code-block:: python

    def migrate(migrator, database, fake=False, **kwargs):
        pass

    def rollback(migrator, database, fake=False, **kwargs):
        pass

.. _bugtracker:

Bug tracker
===========

If you have any suggestions, bug reports or
annoyances please report them to the issue tracker
at https://github.com/klen/peewee_migrate/issues

.. _contributing:

Contributing
============

Development of starter happens at github: https://github.com/klen/peewee_migrate

.. _links:

.. _klen: https://klen.github.io/
.. _Flask: http://flask.pocoo.org/
.. _Flask-PW: https://github.com/klen/flask-pw
.. _Peewee: http://docs.peewee-orm.com/en/latest

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/klen/peewee_migrate",
    "name": "peewee-migrate",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "peewee,migrations,orm",
    "author": "Kirill Klenov",
    "author_email": "horneds@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/23/52/a2faf82c9872d2948935f9e9070ca1cb9e6bcf36d87fde01067ef2c88500/peewee_migrate-1.12.2.tar.gz",
    "platform": null,
    "description": "Peewee Migrate\n##############\n\n.. _description:\n\nPeewee Migrate -- A simple migration engine for Peewee_ ORM\n\n.. _badges:\n\n.. image:: https://github.com/klen/peewee_migrate/workflows/tests/badge.svg\n    :target: https://github.com/klen/peewee_migrate/actions/workflows/tests.yml\n    :alt: Tests Status\n\n.. image:: https://github.com/klen/peewee_migrate/workflows/release/badge.svg\n    :target: https://github.com/klen/peewee_migrate/actions/workflows/release.yml\n    :alt: Build Status\n\n.. image:: https://img.shields.io/pypi/v/peewee-migrate\n    :target: https://pypi.org/project/peewee-migrate/\n    :alt: PYPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/peewee-migrate\n    :target: https://pypi.org/project/peewee-migrate/\n    :alt: Python Versions\n\n.. _contents:\n\n.. contents::\n\n.. _requirements:\n\nRequirements\n=============\n\n- peewee >= 3.8\n\nDependency Note\n---------------\n\n- For ``Peewee<3.0`` please use ``Peewee-Migrate==0.14.0``\n- For ``Python 3.0-3.6`` please use ``Peewee-Migrate==1.1.6``\n- For ``Python 3.7`` please use ``Peewee-Migrate==1.6.6``\n\n.. _installation:\n\nInstallation\n=============\n\n**Peewee Migrate** should be installed using pip: ::\n\n    pip install peewee-migrate\n\n.. _usage:\n\nUsage\n=====\n\nDo you want Flask_ integration? Look at Flask-PW_.\n\nFrom shell\n----------\n\nGetting help: ::\n\n    $ pw_migrate --help\n\n    Usage: pw_migrate [OPTIONS] COMMAND [ARGS]...\n\n    Options:\n        --help  Show this message and exit.\n\n    Commands:\n        create   Create migration.\n        migrate  Run migrations.\n        rollback Rollback migration.\n\nCreate migration: ::\n\n    $ pw_migrate create --help\n\n    Usage: pw_migrate create [OPTIONS] NAME\n\n        Create migration.\n\n    Options:\n        --auto                  FLAG  Scan sources and create db migrations automatically. Supports autodiscovery.\n        --auto-source           TEXT  Set to python module path for changes autoscan (e.g. 'package.models'). Current directory will be recursively scanned by default.\n        --database              TEXT  Database connection\n        --directory             TEXT  Directory where migrations are stored\n        -v, --verbose\n        --help                        Show this message and exit.\n\nRun migrations: ::\n\n    $ pw_migrate migrate --help\n\n    Usage: pw_migrate migrate [OPTIONS]\n\n        Run migrations.\n\n    Options:\n        --name TEXT       Select migration\n        --database TEXT   Database connection\n        --directory TEXT  Directory where migrations are stored\n        -v, --verbose\n        --help            Show this message and exit.\n\nRollback migrations: ::\n\n    $ pw_migrate rollback --help\n\n    Usage: pw_migrate rollback [OPTIONS]\n\n        Rollback a migration with given steps --count of last migrations as integer number\n\n    Options:\n        --count INTEGER   Number of last migrations to be rolled back.Ignored in\n                            case of non-empty name\n\n        --database TEXT   Database connection\n        --directory TEXT  Directory where migrations are stored\n        -v, --verbose\n        --help            Show this message and exit.\n\n\nFrom python\n-----------\n\n.. code-block:: python\n\n    from peewee_migrate import Router\n    from peewee import SqliteDatabase\n\n    router = Router(SqliteDatabase('test.db'))\n\n    # Create migration\n    router.create('migration_name')\n\n    # Run migration/migrations\n    router.run('migration_name')\n\n    # Run all unapplied migrations\n    router.run()\n\nMigration files\n---------------\n\nBy default, migration files are looked up in ``os.getcwd()/migrations`` directory, but custom directory can be given.\n\nMigration files are sorted and applied in ascending order per their filename.\n\nEach migration file must specify ``migrate()`` function and may specify ``rollback()`` function\n\n.. code-block:: python\n\n    def migrate(migrator, database, fake=False, **kwargs):\n        pass\n\n    def rollback(migrator, database, fake=False, **kwargs):\n        pass\n\n.. _bugtracker:\n\nBug tracker\n===========\n\nIf you have any suggestions, bug reports or\nannoyances please report them to the issue tracker\nat https://github.com/klen/peewee_migrate/issues\n\n.. _contributing:\n\nContributing\n============\n\nDevelopment of starter happens at github: https://github.com/klen/peewee_migrate\n\n.. _links:\n\n.. _klen: https://klen.github.io/\n.. _Flask: http://flask.pocoo.org/\n.. _Flask-PW: https://github.com/klen/flask-pw\n.. _Peewee: http://docs.peewee-orm.com/en/latest\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Support for migrations in Peewee ORM",
    "version": "1.12.2",
    "project_urls": {
        "Homepage": "https://github.com/klen/peewee_migrate",
        "Repository": "https://github.com/klen/peewee_migrate"
    },
    "split_keywords": [
        "peewee",
        "migrations",
        "orm"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8c32de329eb77c16ebe2d52971d55954e4c34c7302ab285df8897b8d8dfd705e",
                "md5": "e3c7cfa7458d7b85c65080d331c6b07b",
                "sha256": "2930bf83ef802cdb5fb123116c5eb87cbf3756cb27674f674923be6bb27dabee"
            },
            "downloads": -1,
            "filename": "peewee_migrate-1.12.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e3c7cfa7458d7b85c65080d331c6b07b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 18580,
            "upload_time": "2023-08-07T11:40:02",
            "upload_time_iso_8601": "2023-08-07T11:40:02.468215Z",
            "url": "https://files.pythonhosted.org/packages/8c/32/de329eb77c16ebe2d52971d55954e4c34c7302ab285df8897b8d8dfd705e/peewee_migrate-1.12.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2352a2faf82c9872d2948935f9e9070ca1cb9e6bcf36d87fde01067ef2c88500",
                "md5": "279f621c81556883b6bd8a30b07bdc85",
                "sha256": "c8187c97b756909ea57e77cce06ae66395219e86764ef0b286a7bc72ff7405ad"
            },
            "downloads": -1,
            "filename": "peewee_migrate-1.12.2.tar.gz",
            "has_sig": false,
            "md5_digest": "279f621c81556883b6bd8a30b07bdc85",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 16406,
            "upload_time": "2023-08-07T11:40:04",
            "upload_time_iso_8601": "2023-08-07T11:40:04.545709Z",
            "url": "https://files.pythonhosted.org/packages/23/52/a2faf82c9872d2948935f9e9070ca1cb9e6bcf36d87fde01067ef2c88500/peewee_migrate-1.12.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-07 11:40:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "klen",
    "github_project": "peewee_migrate",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "peewee-migrate"
}
        
Elapsed time: 0.09863s