Cannot migrate second database in ASP.NET Core API

Solution 1:

it seems to me that you need to replace this line with the same one as in the first context

Try change this

  private readonly IDatabaseTwoDBContext _context;

  public DatabaseTwoDBContext(IDatabaseTwoDBContext context)
  {
      this._context = context;
  }

To this

public DatabaseOneDBContext(DbContextOptions<DatabaseTwoDBContext> options)
    : base(options)
{

}

Perhaps the second context is recursively trying to resolve the dependency IDatabaseTwoDBContext in constructor