Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity Framework Migrations OwnsOne Mapping #1190

Open
alansbraga opened this issue Sep 6, 2024 · 2 comments
Open

Entity Framework Migrations OwnsOne Mapping #1190

alansbraga opened this issue Sep 6, 2024 · 2 comments

Comments

@alansbraga
Copy link

I’ve created the following test project to illustrate my problem: https://github.com/alansbraga/DatabaseTest

In my real project, I initially created the structure using .NET 6 and have since migrated to .NET 8. Now, I need to add another property to my class, but EF Migrations tries to delete a column that doesn’t exist.

On GitHub, I’ve created a simplified version of the structure using .NET 8 and migrations. The first time you run it, the structure is created correctly. However, if you try to add another property (you don’t actually have to change anything, just execute the migrations), it tries to remove a property that doesn’t exist.

I've created a PowerShell script named "CreateAndUpdate.ps1" in the root project directory.
The script requires Firebird to be running on port 3050 and the folder 'c:\tmp' to exist.

Thanks in advance.

@gilsonjoanelo
Copy link
Contributor

I didn't quite understand the problem, since there are no migrations in the project, but from what you wrote, it has to do with a migration with some deletion of the column in the down method, and it hasn't been executed in the database yet.

This message was generated with Google Translate

@alansbraga
Copy link
Author

The problem occurs when executing the CreateAndUpdate.ps1 file. This file creates the first migration, updates the database, and after that, without any modifications to the source code, tries to add another migration. In theory, nothing should have changed; however, it tries to delete a field that doesn't exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants