@Override
  public Change[] fixUnexpected(
      DatabaseObject unexpectedObject,
      DiffOutputControl control,
      Database referenceDatabase,
      Database comparisonDatabase,
      ChangeGeneratorChain chain) {
    Sequence sequence = (Sequence) unexpectedObject;

    DropSequenceChange change = new DropSequenceChange();
    change.setSequenceName(sequence.getName());
    if (control.getIncludeCatalog()) {
      change.setCatalogName(sequence.getSchema().getCatalogName());
    }
    if (control.getIncludeSchema()) {
      change.setSchemaName(sequence.getSchema().getName());
    }

    return new Change[] {change};
  }
  /**
   * Drops all objects owned by the connected user.
   *
   * @param schema
   */
  @Override
  public void dropDatabaseObjects(String schema) throws DatabaseException {
    try {
      DatabaseSnapshotGeneratorFactory factory = DatabaseSnapshotGeneratorFactory.getInstance();
      SnapshotContext context = new SnapshotContext();
      context.setDatabase(this);
      context.setSchema(schema);
      context.setListeners(new HashSet<DiffStatusListener>());
      DatabaseSnapshot snapshot = factory.createSnapshot(context);

      List<Change> dropChanges = new ArrayList<Change>();

      for (View view : snapshot.getViews()) {
        DropViewChange dropChange = new DropViewChange();
        dropChange.setViewName(view.getName());
        dropChange.setSchemaName(schema);

        dropChanges.add(dropChange);
      }

      if (!supportsForeignKeyDisable()) {
        for (ForeignKey fk : snapshot.getForeignKeys()) {
          DropForeignKeyConstraintChange dropFK = new DropForeignKeyConstraintChange();
          dropFK.setBaseTableSchemaName(schema);
          dropFK.setBaseTableName(fk.getForeignKeyTable().getName());
          dropFK.setConstraintName(fk.getName());

          dropChanges.add(dropFK);
        }
      }

      // for (Index index : snapshotGenerator.getIndexes()) {
      // DropIndexChange dropChange = new DropIndexChange();
      // dropChange.setIndexName(index.getName());
      // dropChange.setSchemaName(schema);
      // dropChange.setTableName(index.getTableName());
      //
      // dropChanges.add(dropChange);
      // }

      for (Table table : snapshot.getTables()) {
        DropTableChange dropChange = new DropTableChange();
        dropChange.setSchemaName(schema);
        dropChange.setTableName(table.getName());
        if (supportsDropTableCascadeConstraints()) {
          dropChange.setCascadeConstraints(true);
        }

        dropChanges.add(dropChange);
      }

      if (this.supportsSequences()) {
        for (Sequence seq : snapshot.getSequences()) {
          DropSequenceChange dropChange = new DropSequenceChange();
          dropChange.setSequenceName(seq.getName());
          dropChange.setSchemaName(schema);

          dropChanges.add(dropChange);
        }
      }

      if (snapshot.hasDatabaseChangeLogTable()) {
        dropChanges.add(new AnonymousChange(new ClearDatabaseChangeLogTableStatement(schema)));
      }

      final boolean reEnableFK = supportsForeignKeyDisable() && disableForeignKeyChecks();
      try {
        for (Change change : dropChanges) {
          for (SqlStatement statement : change.generateStatements(this)) {
            ExecutorService.getInstance().getExecutor(this).execute(statement);
          }
        }
      } finally {
        if (reEnableFK) {
          enableForeignKeyChecks();
        }
      }

    } finally {
      this.commit();
    }
  }