AuroraMeter. Migration
(Aurora Meter v0.3.0)
View Source
Creates and drops the Aurora Meter core tables, in versions.
A host migration delegates here, so schema changes ship as new versions of
this module rather than as edits to the host's migration file. Every version
is idempotent (create_if_not_exists), so up/1 can safely run from version 1
each time.
Fresh install (generated by mix aurora_meter.gen.migration):
def up, do: AuroraMeter.Migration.up()
def down, do: AuroraMeter.Migration.down()Upgrading an existing install to a newer schema version, add a migration that runs only the new versions:
def up, do: AuroraMeter.Migration.up(from: 2)
def down, do: AuroraMeter.Migration.down(to: 2)Versions
- 1 —
aurora_meter_subscriptions,aurora_meter_counters,aurora_meter_events - 2 —
aurora_meter_history(UTC day buckets forAuroraMeter.history/3)
Summary
Functions
Runs the down step of every version from :version (default the latest)
down to :to (default 1).
The newest schema version this release of Aurora Meter knows about.
Runs the up step of every version from :from (default 1) to :version
(default the latest).
Functions
@spec down(keyword()) :: :ok
Runs the down step of every version from :version (default the latest)
down to :to (default 1).
@spec latest_version() :: pos_integer()
The newest schema version this release of Aurora Meter knows about.
Examples
iex> AuroraMeter.Migration.latest_version()
2
@spec up(keyword()) :: :ok
Runs the up step of every version from :from (default 1) to :version
(default the latest).