Skip to content

Commit

Permalink
Migration for backfill of new launch plan column (#172)
Browse files Browse the repository at this point in the history
The artifact trigger work previously prompted the decision to merge the notion of schedules and artifacts together into a launch plan trigger concept, a [new column](https://github.com/unionai/flyte/pull/83/files#diff-7189b1a0f8ed581ca15085037de7cd70b60305b90e42cc60f7eda13796577788R1227) for which was added to the launch plans table that would indicate whether the trigger type for a launch plan was a schedule or an artifact trigger.  This adds a backfill migration to admin.

Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
  • Loading branch information
wild-endeavor authored Mar 26, 2024
1 parent 130eccd commit 6a38335
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions flyteadmin/pkg/repositories/config/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,22 @@ var ContinuedMigrations = []*gormigrate.Migration{
return tx.Table("launch_plans").Migrator().DropColumn(&models.LaunchPlan{}, "launch_condition_type")
},
},
{
ID: "pg-continue-2024-03-backfill-launch-conditions",
Migrate: func(tx *gorm.DB) error {
query := `` +
`UPDATE launch_plans ` +
`SET launch_condition_type = 'SCHED' ` +
`WHERE schedule_type in ('CRON', 'RATE') ` +
` AND launch_condition_type is null`
tx.Exec(query)

return tx.Error
},
Rollback: func(tx *gorm.DB) error {
return nil
},
},
}

var Migrations = append(LegacyMigrations, append(NoopMigrations, append(ContinuedMigrations, UnionMigrations...)...)...)
Expand Down

0 comments on commit 6a38335

Please sign in to comment.