-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Migration name filter #23222
Comments
Note from triage: we should add this and other similar conflicts to the check we already have. But low priority. |
How could I help with that? |
Would this line/file be the right place to add this check? efcore/src/ef/Commands/MigrationsAddCommand.cs Lines 12 to 20 in a1216b1
|
Hi @ajcvickers, is this still up for grabs? |
@KevRitchie Yes. |
Thanks @ajcvickers. In summary, the changes I'm proposing are:
Does that look OK? I'm also trying to track down the tests for the MigrationsAddCommand, but can't find any. Could you point me in the right direction? Thanks 😄 |
@bricelam Can you comment on the proposed design here? |
@ajcvickers @bricelam - I have a version ready to go 😄 Is there anything else you think I need to add/consider (based on the above implementation)? |
LGTM Feel free to send a PR |
Add a check during the Validate method of MigrationsAddCommand to throw a CommandException when someone tries to call their migration "migration". Fixes #23222
EF Core uses a class Migration, and if you add a new migration with name "Migration" it will break the build.
dotnet ef migrations add Migration
results with Circular base class dependency involving 'Migration' and 'Migration'
I recommend that "migrations add" adds a validation for this...
Include stack traces
Migrations/20201106105308_Migration.cs(6,26): error CS0146: Circular base class dependency involving 'Migration' and 'Migration' [/opt/app/src/src/NM.DAL/NM.DAL.csproj]
Migrations/20201106105308_Migration.cs(8,33): error CS0115: 'Migration.Up(MigrationBuilder)': no suitable method found to override [/opt/app/src/src/NM.DAL/NM.DAL.csproj]
Migrations/20201106105308_Migration.cs(167,33): error CS0115: 'Migration.Down(MigrationBuilder)': no suitable method found to override [/opt/app/src/src/NM.DAL/NM.DAL.csproj]
Migrations/20201106105308_Migration.Designer.cs(16,33): error CS0115: 'Migration.BuildTargetModel(ModelBuilder)': no suitable method found to override [/opt/app/src/src/NM.DAL/NM.DAL.csproj]
Include provider and version information
EF Core version: 3.1.9
Database provider: Postgresql
Target framework: NET 3.1
Operating system: Windows 10
IDE: Visual Studio 2019 16.7.7
The text was updated successfully, but these errors were encountered: