View Source EctoFoundationDB.CLI (Ecto.Adapters.FoundationDB v0.5.0)
This module provides functions that are to be run by an operator, and not part of application code.
Summary
Functions
For each schema item in the database, copies the contents of one field to another.
For each schema item in the database, copies the contents of a set of fields to another set of fields.
For each schema item in the database, deletes the given field.
For each schema item in the database, deletes the given fields.
Ensures all tenants in the database are migrated to the latest version.
Runs the provided 1-arity function for each tenant in the database concurrently.
Functions
For each schema item in the database, copies the contents of one field to another.
Arguments
repo
: The repository to use.schema
: The schema to copy from.from
: The field to copy from.to
: The field to copy to.options
: Options for the operation.
Requirements
- Both fields must exist on the Schema.
Options
:prefix
: If provided, only this tenant will be processed. If not provided, then all tenants concurrently.:max_rows
: Maximum number of items to process in a single transaction.
Also supports options from run_concurrently_for_all_tenants!/3
and EctoFoundationDB.Tenant.open/3
.
For each schema item in the database, copies the contents of a set of fields to another set of fields.
Arguments
repo
: The repository to use.schema
: The schema to copy from.copies
: A Keyword list of fields to copy from and to.options
: Options for the operation.
Requirements
- All fields must exist on the Schema.
Options
:prefix
: If provided, only this tenant will be processed. If not provided, then all tenants concurrently.:max_rows
: Maximum number of items to process in a single transaction.
Also supports options from run_concurrently_for_all_tenants!/3
and EctoFoundationDB.Tenant.open/3
.
For each schema item in the database, deletes the given field.
Arguments
repo
: The repository to use.schema
: The schema to copy from.field
: The field to delete.options
: Options for the operation.
Requirements
- The field must not exist on the Schema.
- The field must not be used in any registered metadata (indexes).
Options
:prefix
: If provided, only this tenant will be processed. If not provided, then all tenants concurrently.:max_rows
: Maximum number of items to process in a single transaction.
Also supports options from run_concurrently_for_all_tenants!/3
and EctoFoundationDB.Tenant.open/3
.
For each schema item in the database, deletes the given fields.
Arguments
repo
: The repository to use.schema
: The schema to copy from.fields
: The list of fields to delete.options
: Options for the operation.
Requirements
- Each field must not exist on the Schema.
- Each field must not be used in any registered metadata (indexes).
Options
:prefix
: If provided, only this tenant will be processed. If not provided, then all tenants concurrently.:max_rows
: Maximum number of items to process in a single transaction.
Also supports options from run_concurrently_for_all_tenants!/3
and EctoFoundationDB.Tenant.open/3
.
Ensures all tenants in the database are migrated to the latest version.
Arguments
repo
: The repository to use.options
: Options to pass to the migration function.
Options
:prefix
: If provided, only this tenant will be migrated. If not provided, then all tenants concurrently.
Also supports options from run_concurrently_for_all_tenants!/3
and EctoFoundationDB.Tenant.open/3
.
run_concurrently_for_all_tenants!(repo, caller_fun, options \\ [])
View SourceRuns the provided 1-arity function for each tenant in the database concurrently.
Arguments
repo
: The Ecto repository to use.caller_fun
: A 1-arity function; the argument is the tenant.options
: Optional keyword list of options.
Options
:async_stream_options
: Options to be passed toTask.async_stream/3
. Defaults toordered: false, max_concurrency: System.schedulers_online() * 2, timeout: :infinity
.