hunk.code_window: 	"github.com/mattermost/mattermost-server/v6/model"
   	"github.com/mattermost/mattermost-server/v6/shared/i18n"
   	"github.com/mattermost/mattermost-server/v6/utils"
   )
   func initDBCommandContextCobra(command *cobra.Command, readOnlyConfigStore bool) (*app.App, error) {
   	a, err := initDBCommandContext(getConfigDSN(command, config.GetEnvironment()), readOnlyConfigStore)
   	if err != nil {
   		// Returning an error just prints the usage message, so actually panic
   		panic(err)
   	}
  
hunk.labels: keep keep keep keep keep replace replace keep keep keep keep
hunk.after_edit: func initDBCommandContextCobra(command *cobra.Command, readOnlyConfigStore bool, options ...app.Option) (*app.App, error) {
   	a, err := initDBCommandContext(getConfigDSN(command, config.GetEnvironment()), readOnlyConfigStore, options...)
  
hunk.file_path: cmd/mattermost/commands/init.go
hunk.type: replace
file: SET @preparedStatement = (SELECT IF(
      (
          SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
          WHERE table_name = 'OAuthApps'
          AND table_schema = DATABASE()
          AND column_name = 'IconURL'
      ) > 0,
      'ALTER TABLE OAuthApps DROP COLUMN IconURL;',
      'SELECT 1'
  ));
  
  PREPARE alterIfExists FROM @preparedStatement;
  EXECUTE alterIfExists;
  DEALLOCATE PREPARE alterIfExists;
  
  SET @preparedStatement = (SELECT IF(
      (
          SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
          WHERE table_name = 'OAuthApps'
          AND table_schema = DATABASE()
          AND column_name = 'IsTrusted'
      ) > 0,
      'ALTER TABLE OAuthApps DROP COLUMN IsTrusted;',
      'SELECT 1'
  ));
  
  PREPARE alterIfExists FROM @preparedStatement;
  EXECUTE alterIfExists;
  DEALLOCATE PREPARE alterIfExists;
  
  SET @preparedStatement = (SELECT IF(
      (
          SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS
          WHERE table_name = 'OAuthApps'
          AND table_schema = DATABASE()
          AND index_name = 'idx_oauthapps_creator_id'
      ) > 0,
      'DROP INDEX idx_oauthapps_creator_id ON OAuthApps;',
      'SELECT 1'
  ));
  
  PREPARE removeIndexIfExists FROM @preparedStatement;
  EXECUTE removeIndexIfExists;
  DEALLOCATE PREPARE removeIndexIfExists;
  
  DROP TABLE IF EXISTS OAuthApps;
  