Coder Social home page Coder Social logo

Comments (8)

m-claes avatar m-claes commented on May 17, 2024 1

Hi, first let me thank you for your quick response and work on this project.
Your proposed solution seems like a viable workaround. If the migration is not yet applied to the database a simple 'Undo changes' on Git could also undo the migration.

I haven't been able to test the other featurese like token generation/endpoints as I was only working on the migrations part for a multi-tenant project (based on you article).

from dotnet-webapi-starter-kit.

iammukeshm avatar iammukeshm commented on May 17, 2024

Hi @m-claes , Are the other features working as expected, as in token generation and other endpoints?

from dotnet-webapi-starter-kit.

iammukeshm avatar iammukeshm commented on May 17, 2024

I did a quick analysis. I believe that since the migrations are applied to multiple databases, and we follow a more dynamic approach of setting connection string, it would rather be NOT possible to remove migrations. Rather you have to create new migrations that revert your changes, these migrations would be applied and are possibly the best way in our current setup. Do let me know if this answers your question.

from dotnet-webapi-starter-kit.

iammukeshm avatar iammukeshm commented on May 17, 2024

Adding to that, these are the commands I use to create migrations to the ApplicationDbContext

dotnet ef migrations add <migration-name> --project .././Migrators/Migrators.MSSQL/ --context ApplicationDbContext -o Migrations/Application

Note that I execute this on the Bootstrapper directory. Also, in this scenario, the migrations are applied only to the MSSQL Migrator. Ensure that you have valid MSSQL connection details in your appsettings.

from dotnet-webapi-starter-kit.

1dveeran avatar 1dveeran commented on May 17, 2024

This error is coming again when i run the below command in windows 10. I am running this command from Host folder.
dotnet ef database update --project ..\Migrators\Migrators.PostgreSQL --context ApplicationDbContext

Build started...
Build succeeded.
[20:08:22 INF] Server Booting Up...
[20:08:23 INF] Hangfire: Current Storage Provider : mssql
[20:08:23 INF] For more HangFire storage, visit https://www.hangfire.io/extensions.html
[20:08:23 INF] Current DB Provider : postgresql
[20:08:25 INF] Connection to root's Database Succeeded.
[20:08:25 INF] For documentations and guides, visit https://www.fullstackhero.net
[20:08:25 INF] To Sponsor this project, visit https://opencollective.com/fullstackhero
[20:08:25 INF] Server Shutting down...
System.InvalidOperationException: A relational store has been configured without specifying either the DbConnection or connection string to use.
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection()
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlRelationalConnection.get_DbConnection()
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlRelationalConnection.CloneWith(String connectionString)
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlDatabaseCreator.Exists(Boolean async, CancellationToken cancellationToken)
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlDatabaseCreator.Exists()
at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists()
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String connectionString, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String connectionString, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
A relational store has been configured without specifying either the DbConnection or connection string to use.

from dotnet-webapi-starter-kit.

iammukeshm avatar iammukeshm commented on May 17, 2024

@1dveeran You dont have to update your database, the application does it for you.
You just have to add the migrations and build the application. You may see an error related to FileName Scope. You can automatically fix it using VSCode

from dotnet-webapi-starter-kit.

iammukeshm avatar iammukeshm commented on May 17, 2024

@1dveeran try to use something like dotnet ef database update --project ..\Migrators\Migrators.MSSQL --context ApplicationDbContext --connection "Server=(localdb)\mssqllocaldb;Initial Catalog=fullStackHeroDb;Integrated Security=True;"

This should work.

from dotnet-webapi-starter-kit.

1dveeran avatar 1dveeran commented on May 17, 2024

Sure I will try this. Thank you.

from dotnet-webapi-starter-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.