Full Mattermost server source with integrated Community Enterprise features. Includes vendor directory for offline/air-gapped builds. Structure: - enterprise-impl/: Enterprise feature implementations - enterprise-community/: Init files that register implementations - enterprise/: Bridge imports (community_imports.go) - vendor/: All dependencies for offline builds Build (online): go build ./cmd/mattermost Build (offline/air-gapped): go build -mod=vendor ./cmd/mattermost 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
56 lines
1.5 KiB
Go
56 lines
1.5 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package migrations
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/mattermost/mattermost/server/public/model"
|
|
"github.com/mattermost/mattermost/server/public/shared/request"
|
|
"github.com/mattermost/mattermost/server/v8/channels/store"
|
|
)
|
|
|
|
const (
|
|
MigrationStateUnscheduled = "unscheduled"
|
|
MigrationStateInProgress = "in_progress"
|
|
MigrationStateCompleted = "completed"
|
|
|
|
JobDataKeyMigration = "migration_key"
|
|
JobDataKeyMigrationLastDone = "last_done"
|
|
)
|
|
|
|
func MakeMigrationsList() []string {
|
|
return []string{
|
|
model.MigrationKeyAdvancedPermissionsPhase2,
|
|
}
|
|
}
|
|
|
|
func GetMigrationState(rctx request.CTX, migration string, store store.Store) (string, *model.Job, *model.AppError) {
|
|
if _, err := store.System().GetByName(migration); err == nil {
|
|
return MigrationStateCompleted, nil, nil
|
|
}
|
|
|
|
jobs, err := store.Job().GetAllByType(rctx, model.JobTypeMigrations)
|
|
if err != nil {
|
|
return "", nil, model.NewAppError("GetMigrationState", "app.job.get_all.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
|
}
|
|
|
|
for _, job := range jobs {
|
|
if key, ok := job.Data[JobDataKeyMigration]; ok {
|
|
if key != migration {
|
|
continue
|
|
}
|
|
|
|
switch job.Status {
|
|
case model.JobStatusInProgress, model.JobStatusPending:
|
|
return MigrationStateInProgress, job, nil
|
|
default:
|
|
return MigrationStateUnscheduled, job, nil
|
|
}
|
|
}
|
|
}
|
|
|
|
return MigrationStateUnscheduled, nil, nil
|
|
}
|