Comments (8)
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-boilerplate.
Hi @m-claes , Are the other features working as expected, as in token generation and other endpoints?
from dotnet-webapi-boilerplate.
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-boilerplate.
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-boilerplate.
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-boilerplate.
@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-boilerplate.
@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-boilerplate.
Sure I will try this. Thank you.
from dotnet-webapi-boilerplate.
Related Issues (20)
- subtenant user login error second time HOT 1
- Localization & Hungfire, appreciate it can be included V2 as well. HOT 2
- [BUG] [V2] Application Shutdown on docker version. HOT 2
- FullStackHero .NET 8 Starter Kit Beta Available! HOT 1
- FullStackHero .NET 8 Starter Kit Beta Available! HOT 1
- Migrations after project structure change, and Masstransit HOT 2
- Seems to be losing connection HOT 1
- Maui Hybrid and Blazor Wasm
- Todo Note not loading
- [BUG] [V2] Blazor Docker Image ApiBaseUrl Harcoded? HOT 3
- Regeneration of Poco HOT 12
- How to release the program to my server?
- How to Use Code Genaration ?
- Latest version fail on Grafana docker HOT 2
- [BUG] Self-Registering not working HOT 1
- CLI issue with Dotnet 8 using Mac HOT 1
- Aspire Dashboard failed to start ! HOT 4
- Updating user role
- Docker build do not finishes HOT 3
- docker compose up fails ... HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnet-webapi-boilerplate.