old migration typing.
This commit is contained in:
parent
82088544f1
commit
b1dc997390
|
@ -1,24 +1,33 @@
|
|||
import { context } from "@budibase/backend-core"
|
||||
import { migrate as migrationImpl, MIGRATIONS } from "../../migrations"
|
||||
import { Ctx } from "@budibase/types"
|
||||
import {
|
||||
Ctx,
|
||||
FetchOldMigrationResponse,
|
||||
GetOldMigrationStatus,
|
||||
RunOldMigrationRequest,
|
||||
} from "@budibase/types"
|
||||
import {
|
||||
getAppMigrationVersion,
|
||||
getLatestEnabledMigrationId,
|
||||
} from "../../appMigrations"
|
||||
|
||||
export async function migrate(ctx: Ctx) {
|
||||
export async function migrate(ctx: Ctx<RunOldMigrationRequest, void>) {
|
||||
const options = ctx.request.body
|
||||
// don't await as can take a while, just return
|
||||
migrationImpl(options)
|
||||
ctx.status = 200
|
||||
}
|
||||
|
||||
export async function fetchDefinitions(ctx: Ctx) {
|
||||
export async function fetchDefinitions(
|
||||
ctx: Ctx<void, FetchOldMigrationResponse>
|
||||
) {
|
||||
ctx.body = MIGRATIONS
|
||||
ctx.status = 200
|
||||
}
|
||||
|
||||
export async function getMigrationStatus(ctx: Ctx) {
|
||||
export async function getMigrationStatus(
|
||||
ctx: Ctx<void, GetOldMigrationStatus>
|
||||
) {
|
||||
const appId = context.getAppId()
|
||||
|
||||
if (!appId) {
|
||||
|
|
|
@ -4,3 +4,4 @@ export * from "./events"
|
|||
export * from "./configs"
|
||||
export * from "./scim"
|
||||
export * from "./license"
|
||||
export * from "./oldMigration"
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
import { Migration, MigrationOptions } from "../../../sdk"
|
||||
|
||||
export interface RunOldMigrationRequest extends MigrationOptions {}
|
||||
|
||||
export type FetchOldMigrationResponse = Migration[]
|
||||
|
||||
export interface GetOldMigrationStatus {
|
||||
migrated: boolean
|
||||
}
|
Loading…
Reference in New Issue