data/recover.go
func recoverServiceStatuses(db *reform.DB) error {
	format := `
		UPDATE channels
		   SET service_status = '%s'
		  FROM offerings, products
		 WHERE offering = offerings.id
		          AND product = products.id
		          AND NOT is_server
		          AND service_status %s`

	query := fmt.Sprintf(format, ServiceSuspended,
		"IN ('activating', 'active', 'suspending')")
	if _, err := db.Exec(query); err != nil {
		return err
	}

	query = fmt.Sprintf(format, ServiceTerminated, " = 'terminating'")
	if _, err := db.Exec(query); err != nil {
		return err
	}

	return nil
}
func recoverServiceStatuses(db *reform.DB) error {
	format := `
		UPDATE channels
		   SET service_status = '%s'
		  FROM offerings, products
		 WHERE offering = offerings.id
		          AND product = products.id
		          AND NOT is_server
		          AND service_status %s`

	query := fmt.Sprintf(format, ServiceSuspended,
		"IN ('activating', 'active', 'suspending')")
	if _, err := db.Exec(query); err != nil {
		return err
	}

	query = fmt.Sprintf(format, ServiceTerminated, " = 'terminating'")
	if _, err := db.Exec(query); err != nil {
		return err
	}

	return nil
}
// recoverServiceStatuses updates service_status for client channels:
// activating, active and suspending becomes suspended, while terminating
// becomes terminated.