-
+
{{ $t('migrate.migrationInProgress') }}
-
+
{{ $t('home.goToOverview') }}
@@ -170,19 +170,18 @@ async function initMigration() {
if (!migratorAuthCode.value) {
return
}
- const {startedAt, finishedAt} = await migrationService.getStatus()
- if (startedAt) {
- lastMigrationStartedAt.value = parseDateOrNull(startedAt)
+ const {started_at, finished_at} = await migrationService.getStatus()
+ if (started_at) {
+ lastMigrationStartedAt.value = parseDateOrNull(started_at)
}
- if (finishedAt) {
- lastMigrationFinishedAt.value = parseDateOrNull(finishedAt)
+ if (finished_at) {
+ lastMigrationFinishedAt.value = parseDateOrNull(finished_at)
if (lastMigrationFinishedAt.value) {
return
}
}
-
+
if (lastMigrationStartedAt.value && lastMigrationFinishedAt.value === null) {
- // Migration already in progress
return
}
@@ -214,6 +213,8 @@ async function migrate() {
message.value = result.message
const projectStore = useProjectStore()
return projectStore.loadProjects()
+ } catch (e) {
+ console.log(e)
} finally {
isMigrating.value = false
}
diff --git a/pkg/modules/migration/handler/handler.go b/pkg/modules/migration/handler/handler.go
index dbfb8e45e..67ce245b3 100644
--- a/pkg/modules/migration/handler/handler.go
+++ b/pkg/modules/migration/handler/handler.go
@@ -73,8 +73,8 @@ func (mw *MigrationWeb) Migrate(c echo.Context) error {
return handler.HandleHTTPError(err, c)
}
- if stats.FinishedAt.IsZero() {
- return c.JSON(http.StatusOK, map[string]string{
+ if !stats.StartedAt.IsZero() && stats.FinishedAt.IsZero() {
+ return c.JSON(http.StatusPreconditionFailed, map[string]string{
"message": "Migration already running",
"running_since": stats.StartedAt.String(),
})
@@ -95,7 +95,7 @@ func (mw *MigrationWeb) Migrate(c echo.Context) error {
return handler.HandleHTTPError(err, c)
}
- return c.JSON(http.StatusOK, models.Message{Message: "Everything was migrated successfully."})
+ return c.JSON(http.StatusOK, models.Message{Message: "Migration was started successfully."})
}
// Status returns whether or not a user has already done this migration