migrations

package
v0.19.1069 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RunnerGroupSettingsBackfillGroupsSQL string
View Source
var RunnerJobAvailableNotifyTriggerSQL string

Functions

This section is empty.

Types

type Migrations

type Migrations struct {
	// contains filtered or unexported fields
}

func New

func New(params Params) *Migrations

func (*Migrations) All

func (m *Migrations) All() []migrations.Migration

func (*Migrations) DeleteAccountsAndSetUUIDAsEmail

func (m *Migrations) DeleteAccountsAndSetUUIDAsEmail(ctx context.Context, db *gorm.DB) error

func (*Migrations) GetAccountsWithEmptyEmails

func (m *Migrations) GetAccountsWithEmptyEmails(ctx context.Context, db *gorm.DB) ([]app.Account, error)

func (*Migrations) Migration002DropOldActionsRunIndex

func (m *Migrations) Migration002DropOldActionsRunIndex(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration09NullWorkflowInstallID

func (m *Migrations) Migration09NullWorkflowInstallID(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration086RunnerGroupSettingsBackfillGroups

func (m *Migrations) Migration086RunnerGroupSettingsBackfillGroups(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration087InstallWorkflowsBackfillOwnership

func (m *Migrations) Migration087InstallWorkflowsBackfillOwnership(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration088AccountsEmailsNotEmpty

func (m *Migrations) Migration088AccountsEmailsNotEmpty(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration089AppBracnhesCleanup

func (m *Migrations) Migration089AppBracnhesCleanup(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration091DeleteOrphanedActionTriggers

func (m *Migrations) Migration091DeleteOrphanedActionTriggers(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration092BackfillOrgID

func (m *Migrations) Migration092BackfillOrgID(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration093AddAdhocActions added in v0.19.784

func (m *Migrations) Migration093AddAdhocActions(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration094VCSCommitPolymorphicOwnership added in v0.19.850

func (m *Migrations) Migration094VCSCommitPolymorphicOwnership(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration095BackfillOrgSupportRole added in v0.19.870

func (m *Migrations) Migration095BackfillOrgSupportRole(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration096BackfillInstallSandboxMode added in v0.19.894

func (m *Migrations) Migration096BackfillInstallSandboxMode(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration097BackfillRunnerGroupOwnerName added in v0.19.894

func (m *Migrations) Migration097BackfillRunnerGroupOwnerName(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration098BackfillQueueSignalEnqueueFinishedAt added in v0.19.903

func (m *Migrations) Migration098BackfillQueueSignalEnqueueFinishedAt(ctx context.Context, db *gorm.DB) error

Migration098BackfillQueueSignalEnqueueFinishedAt sets enqueue_finished_at on all existing queue signals that don't have it and marks them as enqueued. This ensures a clean baseline when the background-enqueue change rolls out.

func (*Migrations) Migration099AppConfigBackfillStatusV2 added in v0.19.915

func (m *Migrations) Migration099AppConfigBackfillStatusV2(ctx context.Context, db *gorm.DB) error

Migration099AppConfigBackfillStatusV2 backfills the status_v2 JSONB column from the legacy v1 status + status_description fields for all app_configs that don't yet have a v2 status set.

func (*Migrations) Migration100FixApprovalOptionDefault added in v0.19.915

func (m *Migrations) Migration100FixApprovalOptionDefault(ctx context.Context, db *gorm.DB) error

Migration100FixApprovalOptionDefault fixes the approval_option column default from 'auto' (invalid) to 'prompt' and backfills existing rows.

func (*Migrations) Migration101SlackChannelSubsCreatorCheck added in v0.19.927

func (m *Migrations) Migration101SlackChannelSubsCreatorCheck(ctx context.Context, db *gorm.DB) error

Migration101SlackChannelSubsCreatorCheck enforces the creator-present invariant on slack_channel_subscriptions: at least one creator identity must be recorded (Slack user OR Nuon account), so a row can always be attributed. GORM doesn't model multi-column CHECKs cleanly, so it lives here as a raw constraint.

func (*Migrations) Migration102WebhooksMatch added in v0.19.927

func (m *Migrations) Migration102WebhooksMatch(ctx context.Context, db *gorm.DB) error

Migration102WebhooksMatch extends the webhooks unique index to include the new match_canonical column so a single (org, url) can be subscribed multiple times with different routing predicates (e.g., once for "all installs" and again for "components in env=prod"). The actual `match` and `match_canonical` columns, plus the new composite index `idx_webhooks_org_url_match`, are added by GORM AutoMigrate (the `gorm-migrations` step in plugins/migrations/exec.go) from the `app.Webhook` struct tags. AutoMigrate runs BEFORE this custom migration, but it does NOT drop indexes that have been removed from struct tags — so the legacy `idx_webhooks_org_url` lingers and must be dropped here.

On an existing DB the effective sequence is:

  1. AutoMigrate adds `match` (jsonb, nullable) and `match_canonical` (text not null, defaulting to the empty string). Existing rows are backfilled to the empty string by that default.
  2. AutoMigrate creates `idx_webhooks_org_url_match` on (org_id, webhook_url, match_canonical, deleted_at). Because every existing row has an empty match_canonical, uniqueness reduces to (org_id, webhook_url, deleted_at), already enforced by the legacy index, so the new index builds without conflicts.
  3. This migration drops the now-redundant legacy `idx_webhooks_org_url`.

Idempotent via DROP INDEX IF EXISTS so re-runs on already-migrated environments are no-ops.

func (*Migrations) Migration103QueueSignalsInflightIndex added in v0.19.932

func (m *Migrations) Migration103QueueSignalsInflightIndex(ctx context.Context, db *gorm.DB) error

Replaces a manually-created sibling whose partial predicate referenced 'in_progress' instead of the Go enum value 'in-progress', so it was never used.

func (*Migrations) Migration104FixStuckGenerateWorkflowStepsSignals added in v0.19.947

func (m *Migrations) Migration104FixStuckGenerateWorkflowStepsSignals(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration105FixSkipNoopsDefault added in v0.19.947

func (m *Migrations) Migration105FixSkipNoopsDefault(ctx context.Context, db *gorm.DB) error

Migration105FixSkipNoopsDefault resets skip_noops to false for all component config connections that were created with the incorrect default of true.

func (*Migrations) Migration106BackfillQueueSignalExpiresAt added in v0.19.969

func (m *Migrations) Migration106BackfillQueueSignalExpiresAt(ctx context.Context, db *gorm.DB) error

Migration106BackfillQueueSignalExpiresAt sets expires_at = created_at + 1 hour for all existing process_healthcheck and healthcheck signals that don't already have an expiry, and sets signal_expires_in on existing emitters so newly emitted signals also get an expiry. This prevents 600k+ stale handler workflows from accumulating.

func (*Migrations) Migration107BackfillEmitterSignalExpiresIn added in v0.19.970

func (m *Migrations) Migration107BackfillEmitterSignalExpiresIn(ctx context.Context, db *gorm.DB) error

Migration107BackfillEmitterSignalExpiresIn sets signal_expires_in = 1 hour for all emitters that don't already have one, so emitted signals expire instead of accumulating indefinitely.

func (*Migrations) Migration108InstallWorkflowsNameHookManaged added in v0.19.974

func (m *Migrations) Migration108InstallWorkflowsNameHookManaged(ctx context.Context, db *gorm.DB) error

Migration108InstallWorkflowsNameHookManaged converts install_workflows.name from a STORED generated column (previous, never-shipped migration) to a plain TEXT column populated by Workflow.BeforeSave / computeWorkflowName.

The backfill below is the last time this title expression appears in SQL. Going forward the source of truth is computeWorkflowName (Go); new rows get their name from the hook on INSERT/UPDATE.

func (*Migrations) Migration109BackfillRunbookStepDeployDependents added in v0.19.1006

func (m *Migrations) Migration109BackfillRunbookStepDeployDependents(ctx context.Context, db *gorm.DB) error

Migration109BackfillRunbookStepDeployDependents copies values from the legacy `deploy_dependencies` column to the new `deploy_dependents` column on runbook_step_configs. The field was renamed because the original name was misleading — the behavior walks the downstream subgraph (dependents), not upstream dependencies. The old column is left in place so a rollback can fall back to it.

func (*Migrations) Migration110CanonicalizeRunbookStepDeployType added in v0.19.1006

func (m *Migrations) Migration110CanonicalizeRunbookStepDeployType(ctx context.Context, db *gorm.DB) error

Migration110CanonicalizeRunbookStepDeployType rewrites the legacy 'deploy' runbook step type to its canonical name, 'component_deploy'. The rename was made to match 'component_tear_down'; the API and config layers still accept 'deploy' on input and canonicalize at ingress, so this only normalizes existing rows.

func (*Migrations) Migration111BackfillLifecyclePhase added in v0.19.1006

func (m *Migrations) Migration111BackfillLifecyclePhase(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration112RunnerJobAvailableNotifyTrigger added in v0.19.1006

func (m *Migrations) Migration112RunnerJobAvailableNotifyTrigger(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration113BackfillRunnerHealthcheckEmitter added in v0.19.1010

func (m *Migrations) Migration113BackfillRunnerHealthcheckEmitter(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration115VcsConnectionUniqueWithDeletedAt added in v0.19.1025

func (m *Migrations) Migration115VcsConnectionUniqueWithDeletedAt(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration116InstallAppConfigVersionMetadataBackfill added in v0.19.1038

func (m *Migrations) Migration116InstallAppConfigVersionMetadataBackfill(ctx context.Context, db *gorm.DB) error

func (*Migrations) Migration117AppBranchUniqueWithDeletedAt added in v0.19.1038

func (m *Migrations) Migration117AppBranchUniqueWithDeletedAt(ctx context.Context, db *gorm.DB) error

type Params

type Params struct {
	fx.In

	AcctClient     *account.Client
	RunnersHelpers *runnershelpers.Helpers
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL