diff --git a/packages/server/src/api/controllers/migrations.ts b/packages/server/src/api/controllers/migrations.ts index 89255e89b1..a3ff0c5810 100644 --- a/packages/server/src/api/controllers/migrations.ts +++ b/packages/server/src/api/controllers/migrations.ts @@ -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) { 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 +) { ctx.body = MIGRATIONS ctx.status = 200 } -export async function getMigrationStatus(ctx: Ctx) { +export async function getMigrationStatus( + ctx: Ctx +) { const appId = context.getAppId() if (!appId) { diff --git a/packages/types/src/api/web/global/index.ts b/packages/types/src/api/web/global/index.ts index efcb6dc39c..c43f2928d8 100644 --- a/packages/types/src/api/web/global/index.ts +++ b/packages/types/src/api/web/global/index.ts @@ -4,3 +4,4 @@ export * from "./events" export * from "./configs" export * from "./scim" export * from "./license" +export * from "./oldMigration" diff --git a/packages/types/src/api/web/global/oldMigration.ts b/packages/types/src/api/web/global/oldMigration.ts new file mode 100644 index 0000000000..4b8ce9cc8d --- /dev/null +++ b/packages/types/src/api/web/global/oldMigration.ts @@ -0,0 +1,9 @@ +import { Migration, MigrationOptions } from "../../../sdk" + +export interface RunOldMigrationRequest extends MigrationOptions {} + +export type FetchOldMigrationResponse = Migration[] + +export interface GetOldMigrationStatus { + migrated: boolean +}