Migrations

The django-logikal application provides an improved migration file writer.

class django_logikal.migration.writer.FormattedMigrationWriter(migration, include_header=True)

Write nicely formatted migration files.

Uses Black and isort with settings compatible with pytest-logikal.

Note

Requires pytest-logikal to be installed.

as_string() str

Return a string of the nicely formatted file contents.

Operations

class django_logikal.migration.operations.GrantModelAccess(*args, **kwargs)

Grant access to a given model.

Parameters:
  • models – An iterable of models to which the operation applies.

  • roles – An iterable of roles to which the accesses apply.

  • accesses – An iterable of accesses to manage.

class django_logikal.migration.operations.RevokeModelAccess(*args, **kwargs)

Revoke access from a given model.

Parameters:
  • models – An iterable of models to which the operation applies.

  • roles – An iterable of roles to which the accesses apply.

  • accesses – An iterable of accesses to manage.

class django_logikal.migration.operations.GrantSchemaAccess(*args, **kwargs)

Grant access to a given schema.

Parameters:
  • schemas – An iterable of schemas to which the operation applies.

  • roles – An iterable of roles to which the accesses apply.

  • accesses – An iterable of accesses to manage.

class django_logikal.migration.operations.RevokeSchemaAccess(*args, **kwargs)

Revoke access from a given schema.

Parameters:
  • schemas – An iterable of schemas to which the operation applies.

  • roles – An iterable of roles to which the accesses apply.

  • accesses – An iterable of accesses to manage.

class django_logikal.migration.operations.CreateUser(*args, **kwargs)

Create a user.

Parameters:
  • name – The user name to use.

  • password – The password to use.

  • exists_ok – Whether to suppress errors related to a user already existing.

class django_logikal.migration.operations.DropUser(*args, **kwargs)

Drop a user.

Parameters:

name – The user name to use.