Skip to content

Commit

Permalink
Disable nullability in migrations (#25626)
Browse files Browse the repository at this point in the history
Closes #25624
  • Loading branch information
roji committed Aug 20, 2021
1 parent 8290672 commit 89828dd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/EFCore.Design/Migrations/Design/CSharpMigrationsGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ public override string GenerateMigration(
.AppendLine(";");
}

builder
.AppendLine()
.AppendLine("#nullable disable");

if (!string.IsNullOrEmpty(migrationNamespace))
{
builder
Expand Down Expand Up @@ -184,6 +188,10 @@ public override string GenerateMetadata(
.AppendLine(";");
}

builder
.AppendLine()
.AppendLine("#nullable disable");

if (!string.IsNullOrEmpty(migrationNamespace))
{
builder
Expand Down Expand Up @@ -276,6 +284,10 @@ public override string GenerateSnapshot(
.AppendLine(";");
}

builder
.AppendLine()
.AppendLine("#nullable disable");

if (!string.IsNullOrEmpty(modelSnapshotNamespace))
{
builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ public void Migrations_compile()
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
#nullable disable
namespace MyNamespace
{
public partial class MyMigration : Migration
Expand Down Expand Up @@ -578,6 +580,8 @@ protected override void Down(MigrationBuilder migrationBuilder)
using Microsoft.EntityFrameworkCore.Migrations.Design;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MyNamespace
{
[DbContext(typeof(CSharpMigrationsGeneratorTest.MyContext))]
Expand Down Expand Up @@ -708,6 +712,8 @@ public void Snapshots_compile()
using Microsoft.EntityFrameworkCore.Migrations.Design;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MyNamespace
{
[DbContext(typeof(CSharpMigrationsGeneratorTest.MyContext))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2582,6 +2582,8 @@ public virtual void Owned_types_can_be_mapped_to_view()
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace RootNamespace
{
[DbContext(typeof(DbContext))]
Expand Down Expand Up @@ -2665,6 +2667,8 @@ public virtual void Snapshot_with_OwnedNavigationBuilder_HasCheckConstraint_comp
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace RootNamespace
{
[DbContext(typeof(DbContext))]
Expand Down Expand Up @@ -5292,6 +5296,8 @@ static List<IProperty> getAllProperties(IModel model)
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NetTopologySuite.Geometries;
#nullable disable
namespace RootNamespace
{
[DbContext(typeof(DbContext))]
Expand Down Expand Up @@ -5674,6 +5680,8 @@ protected virtual string AddBoilerPlate(string code, bool usingSystem = false)
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace RootNamespace
{{
[DbContext(typeof(DbContext))]
Expand Down

0 comments on commit 89828dd

Please sign in to comment.