0.9.6 • Published 4 years ago

@eepos/migrations v0.9.6

Weekly downloads
2
License
MIT
Repository
-
Last release
4 years ago

A simple generic database migration library

Usage

// Create a migration context. You can use one of the provided contexts for postgres and mongodb or write you own
const context = { /*...*/ }

// Define your migrations
const migrations = [
  {
    from: NO_VERSION, // Special version for uninitialized databases
    to: "v1",
    migrate(database) {
      database.doStuff() // The actual migration code
    }
  },
  {
    from: "v1",
    to: "v2",
    migrate(database) {
      database.doOtherStuff()
    }
  },
  /*...*/
]

// Perform the migration to a specific version
// The optimal migration path will automatically be used
await migrate(context, migrations, "v2")
0.9.6

4 years ago

0.9.5

4 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago