Skip to main content

No project description provided

Project description

guillotina_evolution

Build Status PyPI version Codcov

Addon that provides evolutions/migrations to create or update objects in your Guillotina containers.

Install

pip install guillotina_evolution

Configure

Add the following values in app_settings:

app_settings = {
    "applications": [
        "guillotina_evolution",
    ],
    "commands": {
        "g-evolve": "guillotina_evolution.commands.evolve.EvolveCommand",
    },

Configure your app addon to initialize guillotina_evolution when is installed:

from guillotina.component import get_utility
from guillotina_evolution.interfaces import IEvolutionUtility

@configure.addon(name="app", title="Your guillotina app")
class ManageAddon(Addon):
    @classmethod
    async def install(cls, container, request):
        utility = get_utility(IEvolutionUtility)
        utility.install()  # initialize current generation with the greatest registered generation

        # ...

Write your evolver

Create a folder evolutions inside your guillotina app that contains the following files:

app/evolutions/__init__.py

from .r20190118 import *  # noqa
# Don't forget to add all rXXXXXXXX.py!

app/evolutions/r20190118.py

from guillotina_evolution.utils import register_evolution

@register_evolution(1)
async def evolver(container):
    async for item in container.async_items():
        item.title = item.title + ' (Migrated)'
        item.register()

Update the includeme() of your app:

app/__init__.py

def includeme(root):
    # ...
    configure.scan("app.evolutions")

Evolve

Run guillotina command g-evolve to run your migrations.

g -c config.yaml g-evolve

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guillotina_evolution-1.0.1.tar.gz (16.8 kB view details)

Uploaded Source

File details

Details for the file guillotina_evolution-1.0.1.tar.gz.

File metadata

  • Download URL: guillotina_evolution-1.0.1.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.1

File hashes

Hashes for guillotina_evolution-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2b20a18bfd22def533f2e3bff0607bca60494cd3be2483fdb55b402f1ffaa631
MD5 abda872ebc1699495fc69c4c4ce66d40
BLAKE2b-256 457cfeb14cd1d489f098a0fc5423e4ba9200dba65e52da8deab928681ae93457

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page