Versioned migrations for DurableObject tables.
Usage
Generate a migration:
mix ecto.gen.migration add_durable_objectsThen call the versioned migration functions:
defmodule MyApp.Repo.Migrations.AddDurableObjects do
use Ecto.Migration
def up, do: DurableObject.Migration.up(version: 1)
def down, do: DurableObject.Migration.down(version: 1)
endUpgrading
When upgrading to a new version of DurableObject that requires schema changes, generate a new migration and specify both the base version (already applied) and the target version:
mix ecto.gen.migration upgrade_durable_objects_v3
defmodule MyApp.Repo.Migrations.UpgradeDurableObjectsV3 do
use Ecto.Migration
def up, do: DurableObject.Migration.up(base: 2, version: 3)
def down, do: DurableObject.Migration.down(base: 2, version: 3)
endThis runs only version 3's changes, not versions 1-2 which are already applied.
Summary
Functions
Returns the current migration version.
Runs migrations down from the specified version.
Runs migrations up to the specified version.
Functions
Returns the current migration version.
Runs migrations down from the specified version.
Options
:version- Version to roll back from (default: current version):base- Base version to roll back to (default: 0). Migrations will run fromversiondown tobase + 1.:prefix- Table prefix for multi-tenancy (default: nil)
Runs migrations up to the specified version.
Options
:version- Target version (default: current version):base- Base version already applied (default: 0). Migrations will run frombase + 1toversion.:prefix- Table prefix for multi-tenancy (default: nil)