question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] How to do migrations

See original GitHub issue

How do you do migrations in this project?

Based on the clean architecture repo (https://github.com/jasontaylordev/CleanArchitecture) I tried this PS C:\TMP\Blazor\MVP\BlazorClean> dotnet ef migrations add "itemv1" --project src\Infrastructure --startup-project src\Blazor.Server.UI --output-dir Migrators.MSSQL\Migrations

Resulting in error Your target project 'CleanArchitecture.Blazor.Infrastructure' doesn't match your migrations assembly 'CleanArchitecture.Blazor.Migrators.MSSQL'. Either change your target project or change your migrations assembly.

How should the command be for MSSQL?

Issue Analytics

  • State:closed
  • Created 3 months ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
Bram1903commented, Jul 4, 2023

Geen probleem! 😃

@neozhu, I will update the readme somewhere soon, so it’s more clear on how to create migrations. I had the same issue in the beginning, so if we improve the documentation on how to do so, it should be more clear for new users!

2reactions
Bram1903commented, Jul 4, 2023

Hey @jochem4207,

There are multiple options you could use.

Option 1 (Command Line)

Try using the following command, and make sure to replace yourMigrationName with the name you want to give the migration, so in your case, probably itemv1.

dotnet ef migrations add --project src/Migrators/Migrators.MSSQL/Migrators.MSSQL.csproj --startup-project src/Blazor.Server.UI/Blazor.Server.UI.csproj --context CleanArchitecture.Blazor.Infrastructure.Persistence.ApplicationDbContext --configuration Debug yourMigrationName --output-dir Migrations

Option 2 (Visual Studio)

However don’t change the settings to PostgreSQL, since this screenshot is on how to create a migration when using PostgreSQL, but you should get a general idea of how to create a migration.

Option 3 (Rider)

  1. Install the Entity Framework Core UI plugin.
  2. Go to the toolbar and click Tools, then Entity Framework Core, and then Add Migration.

image 4. Click on OK

I hope this helps, and otherwise, let me know!

Kind regards, Bram (Je landgenoot 😊)

Read more comments on GitHub >

github_iconTop Results From Across the Web

11 Questions You Should Be Asking About Data Migration
The 11 Data Migration Questions to Ask & Answers to Expect · Question 1: Who needs to be involved in the process? ·...
Read more >
Frequently Asked Questions On Database Migrations
The following are some questions to ask: Which objects do I want to migrate? Are my data types compatible with those covered by...
Read more >
7 Questions to Ask Before Migrating Data to Your New…
Ask yourself these 7 questions if you're considering a data migration from one venue management software to another, so you don't waste your...
Read more >
Questions to Ask Before Migrating Your Database: A Guide
5 good questions to ask before migrating your database (and answers too) · 1. What's the source and what's the target? · 2....
Read more >
Moving Stories Interview Questions: My Moving Story
Who did you come with and who did you leave behind? · What was the most difficult part about leaving? · What was...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found