// MigrateServices provides a mock function with given fields: ctx, request
11835
func (_m *FacadeInterface) MigrateServices(ctx datastore.Context, request dao.ServiceMigrationRequest) error {
	ret := _m.Called(ctx, request)

	var r0 error
	if rf, ok := ret.Get(0).(func(datastore.Context, dao.ServiceMigrationRequest) error); ok {
		r0 = rf(ctx, request)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
1023608
func (a *api) DeployServiceTemplate(config DeployTemplateConfig) ([]service.ServiceDetails, error) {
	client, err := a.connectMaster()
	if err != nil {
		return nil, err
	}

	req := template.ServiceTemplateDeploymentRequest{
		PoolID:       config.PoolID,
		TemplateID:   config.ID,
		DeploymentID: config.DeploymentID,
	}

	ids, err := client.DeployTemplate(req);
	if err != nil {
		return nil, err
	}

	svcs := make([]service.ServiceDetails, len(ids))
	for i, id := range ids {
		s, err := a.GetServiceDetails(id)
		if err != nil {
			return nil, err
		}

		if !config.ManualAssignIPs {
			a.AssignIP(IPConfig{id, "", 0, "", ""})
		}
		svcs[i] = *s
	}

	return svcs, nil
}
863194
func Migrate(from From, root string) error {
	sys, found := registered[from]
	if !found {
		return ErrNoSuchSystem{
			NotExist: string(from),
			Has:      SystemList(),
		}
	}
	sys, err := sys.Check(root)
	if err != nil {
		return err
	}
	if sys == nil {
		return errors.New("Root not found.")
	}
	return sys.Migrate(root)
}
349901
func (db *DB) MigrateUp() error {
	return db.migrator.Exec(migrate.Up, db.migrations()...)
}
923870
func DefaultMigrateStrategy() *MigrateStrategy {
	return &MigrateStrategy{
		MaxParallel:     1,
		HealthCheck:     MigrateStrategyHealthChecks,
		MinHealthyTime:  10 * time.Second,
		HealthyDeadline: 5 * time.Minute,
	}
}
718850
func (mr *MockDiskMockRecorder) NeedsMigration(arg0, arg1 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NeedsMigration", reflect.TypeOf((*MockDisk)(nil).NeedsMigration), arg0, arg1)
}
364271
func (m *Migrate) RollbackMigration(mig *Migration) error {
	if mig.Rollback == nil {
		return ErrRollbackImpossible
	}

	if err := mig.Rollback(m.db); err != nil {
		return err
	}

	sql := fmt.Sprintf("DELETE FROM %s WHERE %s = ?", m.options.TableName, m.options.IDColumnName)
	if _, err := m.db.Exec(sql, mig.ID); err != nil {
		return err
	}
	return nil
}
42837
func ConvertToK8sService(obj interface{}) interface{} {
	service, ok := obj.(*v1.Service)
	if !ok {
		return nil
	}
	// TODO check which fields we really need
	return &types.Service{
		Service: service,
	}
}
1038005
func migrations(path string) ([]string, error) {
	matches, err := filepath.Glob(path + "/*.sql")
	sort.Strings(matches)
	return matches, err
}
296743
func (s *RedisMapStore) AddMigration(version string, migrate MigrateFunction) {
	s.migrations[version] = migrate
}
720359
func (c *OperatorMigrateCommand) migrate(config *migratorConfig) error {
	from, err := c.newBackend(config.StorageSource.Type, config.StorageSource.Config)
	if err != nil {
		return errwrap.Wrapf("error mounting 'storage_source': {{err}}", err)
	}

	if c.flagReset {
		if err := SetStorageMigration(from, false); err != nil {
			return errwrap.Wrapf("error reseting migration lock: {{err}}", err)
		}
		return nil
	}

	to, err := c.newBackend(config.StorageDestination.Type, config.StorageDestination.Config)
	if err != nil {
		return errwrap.Wrapf("error mounting 'storage_destination': {{err}}", err)
	}

	migrationStatus, err := CheckStorageMigration(from)
	if err != nil {
		return errwrap.Wrapf("error checking migration status: {{err}}", err)
	}

	if migrationStatus != nil {
		return fmt.Errorf("Storage migration in progress (started: %s).", migrationStatus.Start.Format(time.RFC3339))
	}

	if err := SetStorageMigration(from, true); err != nil {
		return errwrap.Wrapf("error setting migration lock: {{err}}", err)
	}

	defer SetStorageMigration(from, false)

	ctx, cancelFunc := context.WithCancel(context.Background())

	doneCh := make(chan error)
	go func() {
		doneCh <- c.migrateAll(ctx, from, to)
	}()

	select {
	case err := <-doneCh:
		cancelFunc()
		return err
	case <-c.ShutdownCh:
		c.UI.Output("==> Migration shutdown triggered\n")
		cancelFunc()
		<-doneCh
		return errAbort
	}
}
954970
func (s *MigrationService) StartUserMigration(ctx context.Context, repos []string, opt *UserMigrationOptions) (*UserMigration, *Response, error) {
	u := "user/migrations"

	body := &startUserMigration{Repositories: repos}
	if opt != nil {
		body.LockRepositories = Bool(opt.LockRepositories)
		body.ExcludeAttachments = Bool(opt.ExcludeAttachments)
	}

	req, err := s.client.NewRequest("POST", u, body)
	if err != nil {
		return nil, nil, err
	}

	// TODO: remove custom Accept header when this API fully launches.
	req.Header.Set("Accept", mediaTypeMigrationsPreview)

	m := &UserMigration{}
	resp, err := s.client.Do(ctx, req, m)
	if err != nil {
		return nil, resp, err
	}

	return m, resp, nil
}
269957
func MigrateReset(currpath, driver, connStr, dir string) {
	migrate("reset", currpath, driver, connStr, dir)
}
834222
func (h *HandlerService) DumpServices() {
	for name := range handlers {
		logger.Log.Infof("registered handler %s, isRawArg: %s", name, handlers[name].IsRawArg)
	}
}
1345169
func (g *Gormigrate) MigrateTo(migrationID string) error {
	if err := g.checkIDExist(migrationID); err != nil {
		return err
	}
	return g.migrate(migrationID)
}
85927
func (ls *LocalStore) Migrate() error {
	actualDbSchema, err := ls.DbStore.GetSchema()
	if err != nil {
		log.Error(err.Error())
		return err
	}

	if actualDbSchema == CurrentDbSchema {
		return nil
	}

	log.Debug("running migrations for", "schema", actualDbSchema, "runtime-schema", CurrentDbSchema)

	if actualDbSchema == DbSchemaNone {
		ls.migrateFromNoneToPurity()
		actualDbSchema = DbSchemaPurity
	}

	if err := ls.DbStore.PutSchema(actualDbSchema); err != nil {
		return err
	}

	if actualDbSchema == DbSchemaPurity {
		if err := ls.migrateFromPurityToHalloween(); err != nil {
			return err
		}
		actualDbSchema = DbSchemaHalloween
	}

	if err := ls.DbStore.PutSchema(actualDbSchema); err != nil {
		return err
	}
	return nil
}
708800
func (m *MigrationsService) Run(models []interface{}) error {
	conn, err := m.Connections.Make()

	if err != nil {
		return err
	}

	conn.AutoMigrate(models...)
	return nil
}