INNER CODE UNIT · Go
migrationApp
theopenlane/core · cmd/catalog/migrate/main.go:38
func migrationApp() *cli.Command {
app := &cli.Command{
Name: "pricemigrate",
Usage: "tag and optionally migrate subscriptions to a new price",
Flags: []cli.Flag{
&cli.StringFlag{Name: "old-price", Usage: "price ID to migrate from", Required: true},
&cli.StringFlag{Name: "new-price", Usage: "price ID to migrate to", Required: true},
&cli.StringSliceFlag{Name: "customers", Usage: "comma separated customer IDs to migrate"},
&cli.StringFlag{Name: "stripe-key", Usage: "stripe API key", Sources: cli.EnvVars("STRIPE_API_KEY")},
&cli.BoolFlag{Name: "no-migrate", Usage: "only tag the price and do not update subscriptions"},
&cli.BoolFlag{Name: "dry-run", Usage: "list customers and subscriptions that would be migrated", Value: true}, // default to true to avoid accidental migrations
},
Action: func(ctx context.Context, c *cli.Command) error {
oldPrice := c.String("old-price")
newPrice := c.String("new-price")
apiKey := c.String("stripe-key")
customers := c.StringSlice("customers")
skip := c.Bool("no-migrate")