@openland/foundationdb

@openland/foundationdb

  • Docs
  • Chat

›Layers

Getting Started

  • Getting Started
  • Installation
  • Hello world

Entity Layer

  • Overview

Layers

  • Singleton Worker
  • Migrations
  • PubSub
  • Random ID
  • Distributed Lock

Reference

  • Database
  • Transactions
  • Subspaces
  • Directory Layer

Migrations layer

Layer for performing migrations

Dependencies

This layer does not have any depdendencies

Install

yarn install @openland/foundationdb-migrations

and then add layer in your initialization code:

import { Database } from '@openland/foundationdb';
import { MigrationsLayer } from '@openland/foundationdb-migrations';

let db = await Database.open({
    layers: [
        /* other layers */
        new MigrationsLayer(/* Your migrations */)
    ]
});

Usage

import { inTx } from '@openland/foundationdb';
import { MigrationDefinition } from '@openland/foundationdb-migrations';

// Declare migrations

let migrations: MigrationDefinition[] = [];

migrations.push({
    key: '100-remove-invalid-users' /* Unique Key of migration */,
    migration: async (parent) => {
        // Perform migration
    }
});

// Start database

let db = await Database.open({
    layers: [
        /* other layers */
        new MigrationsLayer(migrations)
    ]
});
← Singleton WorkerPubSub →
  • Dependencies
  • Install
  • Usage
Docs
Getting Started
Community
Chat in Openland
Sources
GitHubStar
Copyright © 2021 Openland