PhoenixKitStats.Migrations.Schema (PhoenixKitStats v0.2.1)

Copy Markdown View Source

Versioned migration for the Stats module.

Creates the phoenix_kit_stats_groups table. All statements use IF NOT EXISTS guards — safe to run multiple times.

Implements the versioned-migration protocol expected by PhoenixKit Core (mix phoenix_kit.update): current_version/0 and migrated_version_runtime/1. Reference implementation — PhoenixKit.Modules.Legal.Migrations.ConsentLogs in phoenix_kit_legal.

Summary

Functions

Target schema version of the Stats module.

Rolls back the Stats module migration.

Currently applied schema version, read from the database.

Applies the Stats module migration.

Functions

current_version()

Target schema version of the Stats module.

down(opts \\ [])

Rolls back the Stats module migration.

Accepts a keyword list (the form Core passes) or a map, for backward compatibility.

migrated_version_runtime(opts \\ [])

Currently applied schema version, read from the database.

Returns 0 when the phoenix_kit_stats_groups table does not yet exist, and 1 once it has been created. opts is a keyword list with an optional :prefix.

up(opts \\ [])

Applies the Stats module migration.

Accepts a keyword list (the form Core passes) or a map, for backward compatibility.