filterSchemaForUserModels function

SchemaDocument filterSchemaForUserModels(
  1. SchemaDocument schema, {
  2. required String historyTableName,
})

Returns schema without the provider history table model.

Implementation

SchemaDocument filterSchemaForUserModels(
  SchemaDocument schema, {
  required String historyTableName,
}) {
  return SchemaDocument(
    models: List<ModelDefinition>.unmodifiable(
      schema.models
          .where((model) => model.name != historyTableName)
          .toList(growable: false),
    ),
    enums: List<EnumDefinition>.unmodifiable(schema.enums),
    datasources: List<DatasourceDefinition>.unmodifiable(schema.datasources),
    generators: List<GeneratorDefinition>.unmodifiable(schema.generators),
  );
}