code: public Sql[] generateSqlIfExists(final DropSpatialIndexStatement statement,
           final Database database) {
        final String catalogName = statement.getTableCatalogName();
        final String schemaName = statement.getTableSchemaName();
        final String tableName = statement.getTableName();
        final SpatialIndexExistsPrecondition precondition = new SpatialIndexExistsPrecondition();
        precondition.setCatalogName(catalogName);
        precondition.setSchemaName(schemaName);
        precondition.setTableName(tableName);
        final DatabaseObject example = precondition.getExample(database, tableName);
        try {
           // If a spatial index exists on the table, drop it.
           if (SnapshotGeneratorFactory.getInstance().has(example, database)) {
              return generateSql(statement, database, null);
           }
        } catch (final Exception e) {
           throw new UnexpectedLiquibaseException(e);
        }
        return new Sql[0];
     }
docs: Generates the SQL statement to drop the spatial index if it exists.
  
  @param statement
  the drop spatial index statement.
  @param database
  the database.
  @return the drop spatial index statement, if the index exists.