CampaignFlow.MockServer.Migrations (CampaignFlow Client v2.2.0)

View Source

Migrations for the mock server PostgreSQL tables.

Usage

Generate a migration in your application:

mix ecto.gen.migration add_campaign_flow_mock_server

Then call the migration functions:

defmodule MyApp.Repo.Migrations.AddCampaignFlowMockServer do
  use Ecto.Migration

  def up, do: CampaignFlow.MockServer.Migrations.up(version: 1)
  def down, do: CampaignFlow.MockServer.Migrations.down(version: 1)
end

Schema reset

This migration is for a mock/dev/test server. When the definition changes (as it did when integer IDs replaced UUIDs and the campaign schema was expanded to match the OpenAPI Campaign shape), existing dev/test databases must be dropped and recreated — there is no incremental upgrade path. For the bundled test repo:

MIX_ENV=test mix ecto.drop --repo CampaignFlow.TestRepo
MIX_ENV=test mix ecto.create --repo CampaignFlow.TestRepo

Summary

Functions

Returns the current migration version.

Runs the down migrations from the specified version.

Runs the up migrations up to the specified version.

Functions

current_version()

Returns the current migration version.

down(opts \\ [])

Runs the down migrations from the specified version.

up(opts \\ [])

Runs the up migrations up to the specified version.