peewee-migrate


Namepeewee-migrate JSON
Version 1.13.0 PyPI version JSON
download
home_pagehttps://github.com/klen/peewee_migrate
SummarySupport for migrations in Peewee ORM
upload_time2024-07-17 10:13:32
maintainerNone
docs_urlNone
authorKirill Klenov
requires_python<4.0,>=3.8
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``
- For ``Python 3.8+`` please use ``Peewee-Migrate>=1.12.1``

.. _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": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "peewee, migrations, orm",
    "author": "Kirill Klenov",
    "author_email": "horneds@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c7/66/8d5ad45ea396623533a9cb2bbf78fdcc52efb65f7db058d7dc2523e1dd41/peewee_migrate-1.13.0.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- For ``Python 3.8+`` please use ``Peewee-Migrate>=1.12.1``\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.13.0",
    "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": "e8f9bf657b918756b0b15d85845b351c0074b1d953798b8c72c05b4a456baf06",
                "md5": "375bad77372920569720ecfda6c7be98",
                "sha256": "66597f5b8549a8ff456915db60e8382daf7839eef79352027e7cf54feec56860"
            },
            "downloads": -1,
            "filename": "peewee_migrate-1.13.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "375bad77372920569720ecfda6c7be98",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 19425,
            "upload_time": "2024-07-17T10:13:29",
            "upload_time_iso_8601": "2024-07-17T10:13:29.255679Z",
            "url": "https://files.pythonhosted.org/packages/e8/f9/bf657b918756b0b15d85845b351c0074b1d953798b8c72c05b4a456baf06/peewee_migrate-1.13.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c7668d5ad45ea396623533a9cb2bbf78fdcc52efb65f7db058d7dc2523e1dd41",
                "md5": "d2dbd2b3c4ceef37ab3973b8481d6dcb",
                "sha256": "1ab67f72a0936006155e1b310c18a32f79e4dff3917cfeb10112ca92518721e5"
            },
            "downloads": -1,
            "filename": "peewee_migrate-1.13.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d2dbd2b3c4ceef37ab3973b8481d6dcb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 17119,
            "upload_time": "2024-07-17T10:13:32",
            "upload_time_iso_8601": "2024-07-17T10:13:32.431504Z",
            "url": "https://files.pythonhosted.org/packages/c7/66/8d5ad45ea396623533a9cb2bbf78fdcc52efb65f7db058d7dc2523e1dd41/peewee_migrate-1.13.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-17 10:13:32",
    "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.43710s