View Source Mix.ArangoXEcto (ArangoX Ecto v1.3.1)

Migration task helper functions

Link to this section Summary

Types

Specifies a migration version type

Functions

Creates the database specified in the config

Creates a new database of name

Creates a document to store migrations

Creates the migrations collection

Gets the default repo's database name

Gets the default repo

Gets all the migrated versions

Gets the path to the priv repo folder

Removes a version from the migrations collection

Creates a timestamp for the migration file

Updates the migrated versions in the migration collection

Link to this section Types

@type version() :: String.t() | Integer.t()

Specifies a migration version type

Link to this section Functions

@spec create_base_database() :: {:ok, String.t()} | {:error, Integer.t()}

Creates the database specified in the config

@spec create_database(String.t()) :: {:ok, String.t()} | {:error, Integer.t()}

Creates a new database of name

Link to this function

create_migration_document()

View Source
@spec create_migration_document() :: :ok | {:error, Integer.t()}

Creates a document to store migrations

Creates a document with key of the database name. Seperating the migrations into seperate documents allow for more organisation and better debugging.

@spec create_migrations() :: :ok | {:error, Integer.t()}

Creates the migrations collection

Creates an empty system collection to store migrations.

@spec get_database_name!() :: String.t()

Gets the default repo's database name

@spec get_default_repo!() :: Ecto.Repo.t()

Gets the default repo

The first in the list of running repos is used.

Link to this function

migrated_versions(db_name)

View Source
@spec migrated_versions(String.t()) :: [String.t() | Integer.t()]

Gets all the migrated versions

@spec path_to_priv_repo(Ecto.Repo.t()) :: String.t()

Gets the path to the priv repo folder

Will return a full file path to the priv/repo folder.

Link to this function

remove_version(version, db_name)

View Source
@spec remove_version(version(), String.t()) :: [version()]

Removes a version from the migrations collection

@spec timestamp() :: String.t()

Creates a timestamp for the migration file

Link to this function

update_versions(version, db_name)

View Source
@spec update_versions(version(), String.t()) :: [version()]

Updates the migrated versions in the migration collection