View Source Plausible.Release (Plausible v0.0.1)

Summary

Functions

Link to this function

configure_ref_inspector()

View Source
Link to this function

configure_ua_inspector()

View Source
Link to this function

createdb(repos \\ repos())

View Source
Link to this function

interweave_migrate(repos \\ repos())

View Source

interweave_migrate/0 is a migration function that:

  • Lists all pending migrations across multiple repositories.
  • Sorts these migrations into a single list.
  • Groups consecutive migrations by repository into "streaks".
  • Executes the migrations in the correct order by processing each streak sequentially.

Why Use This Approach?

This function resolves dependencies between migrations that span across different repositories. The default migrate/0 function migrates each repository independently, which may result in migrations running in the wrong order when there are cross-repository dependencies.

Consider the following example (adapted from reality, not 100% accurate):

  • Migration 1: The PostgreSQL (PG) repository creates a table named site_imports.
  • Migration 2: The ClickHouse (CH) repository creates import_id columns in imported_* tables.
  • Migration 3: The PG repository runs a data migration that utilizes both PG and CH databases, reading from the import_id column in imported_* tables.

The default migrate/0 would execute these migrations by repository, resulting in the following order:

  1. Migration 1 (PG)
  2. Migration 3 (PG)
  3. Migration 2 (CH)

This sequence would fail at Migration 3, as the import_id columns in the CH repository have not been created yet.

interweave_migrate/0 addresses this issue by consolidating all pending migrations into a single, ordered queue:

  1. Migration 1 (PG)
  2. Migration 2 (CH)
  3. Migration 3 (PG)

This ensures all dependencies are resolved in the correct order.

Link to this function

pending_streaks(repos \\ repos())

View Source
Link to this function

should_be_first_launch?()

View Source