package liquibase.ext.spanner;

import liquibase.database.Database;
import liquibase.exception.ValidationErrors;
import liquibase.sqlgenerator.SqlGenerator;
import liquibase.sqlgenerator.SqlGeneratorChain;
import liquibase.sqlgenerator.core.RenameColumnGenerator;
import liquibase.statement.core.RenameColumnStatement;

public class SpannerRenameColumnGenerator extends RenameColumnGenerator {
  static final String RENAME_COLUMN_VALIDATION_ERROR =
      "Cloud Spanner does not support renaming a column";

  @Override
  public ValidationErrors validate(
      RenameColumnStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors errors = super.validate(statement, database, sqlGeneratorChain);
    errors.addError(RENAME_COLUMN_VALIDATION_ERROR);
    return errors;
  }

  @Override
  public int getPriority() {
    return SqlGenerator.PRIORITY_DATABASE;
  }

  @Override
  public boolean supports(RenameColumnStatement statement, Database database) {
    return (database instanceof CloudSpanner);
  }
}

@@ -1,8 +1,603 @@
+/**%0A * Copyright 2020 Google LLC%0A *%0A * %3Cp%3ELicensed under the Apache License, Version 2.0 (the %22License%22); you may not use this file%0A * except in compliance with the License. You may obtain a copy of the License at%0A *%0A * %3Cp%3Ehttps://www.apache.org/licenses/LICENSE-2.0%0A *%0A * %3Cp%3EUnless required by applicable law or agreed to in writing, software distributed under the%0A * License is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either%0A * express or implied. See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A
 package 

add missing license header