mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-04-02 05:23:21 +00:00
add utils to migrations up and down
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { ManifestVersion } from "../../manifest/ManifestTypes"
|
||||
import { Effects } from "../../types"
|
||||
import { Utils } from "../../util"
|
||||
|
||||
export class Migration<Version extends ManifestVersion> {
|
||||
export class Migration<Version extends ManifestVersion, WD> {
|
||||
constructor(
|
||||
readonly options: {
|
||||
version: Version
|
||||
up: (opts: { effects: Effects }) => Promise<void>
|
||||
down: (opts: { effects: Effects }) => Promise<void>
|
||||
up: (opts: { effects: Effects; utils: Utils<WD> }) => Promise<void>
|
||||
down: (opts: { effects: Effects; utils: Utils<WD> }) => Promise<void>
|
||||
},
|
||||
) {}
|
||||
static of<Version extends ManifestVersion>(options: {
|
||||
@@ -17,11 +18,11 @@ export class Migration<Version extends ManifestVersion> {
|
||||
return new Migration(options)
|
||||
}
|
||||
|
||||
async up(opts: { effects: Effects }) {
|
||||
async up(opts: { effects: Effects; utils: Utils<WD> }) {
|
||||
this.up(opts)
|
||||
}
|
||||
|
||||
async down(opts: { effects: Effects }) {
|
||||
async down(opts: { effects: Effects; utils: Utils<WD> }) {
|
||||
this.down(opts)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user