Skip to content

Test EnsureMigrationsAreUpToDate fails #114

Description

@christoph-maurer
failed EnsureMigrationsAreUpToDate (22s 209ms)
  Expected modelDifferences to be an empty collection because you forgot to add a migration with `make migration NAME='...' in the shell `./docker.mk shell SERVICE=backend`., but found extraneous items Microsoft.EntityFrameworkCore.Migrations.Operations.SqlOperation
  {
      IsDestructiveChange = False,
      IsReadOnly = False,
      Sql = "DROP FUNCTION "database"."LC_TRIGGER_get_https_resource_root_can_only_be_deleted_alongside_its_data"() CASCADE;",
      SuppressTransaction = False
  } (at index 0), Microsoft.EntityFrameworkCore.Migrations.Operations.SqlOperation
  {
      IsDestructiveChange = False,
      IsReadOnly = False,
      Sql = "CREATE FUNCTION "database"."LC_TRIGGER_resource_root_can_only_deleted_alongside_its_data"() RETURNS trigger as $LC_TRIGGER_resource_root_can_only_deleted_alongside_its_data$
  BEGIN
    IF OLD."ParentId" IS NULL AND (
      (OLD."CalorimetricDataId" IS NOT NULL AND EXISTS (
      SELECT 1 FROM database."calorimetric_data"
      WHERE "Id" = OLD."CalorimetricDataId"
  )) OR (OLD."GeometricDataId" IS NOT NULL AND EXISTS (
      SELECT 1 FROM database."geometric_data"
      WHERE "Id" = OLD."GeometricDataId"
  )) OR (OLD."HygrothermalDataId" IS NOT NULL AND EXISTS (
      SELECT 1 FROM database."hygrothermal_data"
      WHERE "Id" = OLD."HygrothermalDataId"
  )) OR (OLD."LifeCycleDataId" IS NOT NULL AND EXISTS (
      SELECT 1 FROM database."lifeCycle_data"
      WHERE "Id" = OLD."LifeCycleDataId"
  )) OR (OLD."OpticalDataId" IS NOT NULL AND EXISTS (
      SELECT 1 FROM database."optical_data"
      WHERE "Id" = OLD."OpticalDataId"
  )) OR (OLD."PhotovoltaicDataId" IS NOT NULL AND EXISTS (
      SELECT 1 FROM database."photovoltaic_data"
      WHERE "Id" = OLD."PhotovoltaicDataId"
  ))
  ) THEN
      RAISE EXCEPTION 'You cannot delete a root resource without also deleting the corresponding data in the same transaction.';
  END IF;
  RETURN OLD;
  END;
  $LC_TRIGGER_resource_root_can_only_deleted_alongside_its_data$ LANGUAGE plpgsql;
  CREATE TRIGGER LC_TRIGGER_resource_root_can_only_deleted_alongside_its_data AFTER DELETE
  ON "database"."get_https_resource"
  FOR EACH ROW EXECUTE PROCEDURE "database"."LC_TRIGGER_resource_root_can_only_deleted_alongside_its_data"();",
      SuppressTransaction = False
  } (at index 1)
  
  With configuration:
  - Prefer the declared type of the members
  - Compare enums by value
  - Compare tuples by their properties
  - Compare anonymous types by their properties
  - Compare records by their members
  - Include non-browsable members
  - Include all non-private properties
  - Include all non-private fields
  - Match (JSON) member by name (or throw)
  - Be strict about the order of items in byte arrays
  - Without automatic conversion
  
    at FluentAssertions.Collections.GenericCollectionAssertions`3.BeEquivalentTo[TExpectation](IEnumerable`1 expectation, Func`2 config, String because, Object[] becauseArgs)
    at FluentAssertions.Collections.GenericCollectionAssertions`3.BeEquivalentTo[TExpectation](IEnumerable`1 expectation, String because, Object[] becauseArgs)
    at Database.Tests.Integration.MigrationTests.<>c.<<EnsureMigrationsAreUpToDate>b__0_0>d.MoveNext() in Integration/MigrationTests.cs:54
    --- End of stack trace from previous location ---
    at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.GetResult()
    at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](TestExecutionContext context, Func`1 invoke)
    at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(TestExecutionContext context, Func`1 invoke)
    at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
    at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
    at NUnit.Framework.Internal.Commands.AfterTestCommand.<>c__DisplayClass1_0.<Execute>b__0()
    at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)

Metadata

Metadata

Labels

ISEFraunhofer Institute for Solar Energy Systems ISEbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions