Skip to content

CI: Codify migrations procedure #1022

@jimbojw

Description

@jimbojw

From time to time, data formats for Deliberate Lab may change. In such cases, existing documents in the Firestore database may need to be bulk migrated to a new format. For example, #939 introduces a functions/src/migrations/migrate-variable-configs.ts file, which converts variable configurations from an older to newer format.

Managing schema migrations such as this is not a new problem. SQL table schemas have the same problem.

We should investigate industry best practices for migrating documents in document datastores like Firebase so that we can choose a strategy for handling these going forward. We should aim to serve both the canonical Deliberate Lab installation as well as third parties running their own instances.

Two concerns are top of mind:

  1. Running hermetic migrations: Building and running migration scripts in a hermetic environment such as Google Cloud Build. This avoids problems of local development setup, which may be in a bad state.
  2. Automatically running migrations: Detecting whether migrations have run, and if not, running them exactly once. This could be rolled into the canonical Google Cloud Build pipeline so that running an "all" deployment automatically performs migrations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions