anchor.diff:      return asJson;
     }
   
  -  Map _entityToJson(DriftSchemaEntity entity) {
  +  Map _entityToJson(DriftElement entity) {
       String type;
       Map data;
   
       if (entity is DriftTable) {
         type = 'table';
         data = _tableData(entity);
  -    } else if (entity is MoorTrigger) {
  +    } else if (entity is DriftTrigger) {
         type = 'trigger';
         data = {
           'on': _idOf(entity.on!),
           'refences_in_body': [
  -          for (final ref in entity.bodyReferences) _idOf(ref),
  +          for (final ref in entity.references.whereType<DriftSchemaElement>())
  +            _idOf(ref),
           ],
  -        'name': entity.displayName,
  -        'sql': entity.createSql(options),
  -      };
  -    } else if (entity is MoorIndex) {
  +        'name': entity.schemaName,
  +        'sql': entity.createStmt,
  +      };
  +    } else if (entity is DriftIndex) {
         type = 'index';
         data = {
           'on': _idOf(entity.table!),
  -        'name': entity.name,
  +        'name': entity.schemaName,
           'sql': entity.createStmt,
         };
  -    } else if (entity is MoorView) {
  -      if (entity.declaration is! DriftViewDeclaration) {
  +    } else if (entity is DriftView) {
  +      final source = entity.source;
  +      if (source is! SqlViewSource) {
           throw UnsupportedError(
               'Exporting Dart-defined views into a schema is not '
               'currently supported');
  
positive.code:     };
    }
  
    dynamic _dslFeatureData(ColumnFeature feature) {
      if (feature is AutoIncrement) {
        return 'auto-increment';
      } else if (feature is PrimaryKey) {
        return 'primary-key';
      } else if (feature is LimitingTextLength) {
        return {
          'allowed-lengths': {
  
negative.code:     _rawById.keys.forEach(_processById);
    }
  
    T _existingEntity<T extends DriftElement>(dynamic id) {
      return _entitiesById[id as int] as T;
    }
  
    DriftElementId _id(String name) => DriftElementId(_elementUri, name);
  
    DriftDeclaration get _declaration =>
        DriftDeclaration(_elementUri, -1, '<unknown>');
  
    void _processById(int id) {
      if (_entitiesById.containsKey(id)) return;
  