-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Using a Separate Migrations Project
- Loading branch information
1 parent
c9a7fe0
commit dd2e5dd
Showing
9 changed files
with
159 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\CF.Customer.Infrastructure\CF.Customer.Infrastructure.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
23 changes: 14 additions & 9 deletions
23
...tions/20201026103509_Customer.Designer.cs → ...240108231037_InitialMigration.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
src/CF.Migrations/Migrations/20240108231037_InitialMigration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace CF.Migrations.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class InitialMigration : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "Customer", | ||
columns: table => new | ||
{ | ||
Id = table.Column<long>(type: "bigint", nullable: false) | ||
.Annotation("SqlServer:Identity", "1, 1"), | ||
Created = table.Column<DateTime>(type: "datetime2", nullable: false), | ||
Email = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false), | ||
FirstName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false), | ||
Password = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false), | ||
Surname = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false), | ||
Updated = table.Column<DateTime>(type: "datetime2", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Customer", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Customer_Email", | ||
table: "Customer", | ||
column: "Email", | ||
unique: true); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "Customer"); | ||
} | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
src/CF.Migrations/Migrations/CustomerContextModelSnapshot.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// <auto-generated /> | ||
using System; | ||
using CF.Customer.Infrastructure.DbContext; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; | ||
|
||
#nullable disable | ||
|
||
namespace CF.Migrations.Migrations | ||
{ | ||
[DbContext(typeof(CustomerContext))] | ||
partial class CustomerContextModelSnapshot : ModelSnapshot | ||
{ | ||
protected override void BuildModel(ModelBuilder modelBuilder) | ||
{ | ||
#pragma warning disable 612, 618 | ||
modelBuilder | ||
.HasAnnotation("ProductVersion", "8.0.0") | ||
.HasAnnotation("Relational:MaxIdentifierLength", 128); | ||
|
||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); | ||
|
||
modelBuilder.Entity("CF.Customer.Domain.Entities.Customer", b => | ||
{ | ||
b.Property<long>("Id") | ||
.ValueGeneratedOnAdd() | ||
.HasColumnType("bigint"); | ||
|
||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id")); | ||
|
||
b.Property<DateTime>("Created") | ||
.HasColumnType("datetime2"); | ||
|
||
b.Property<string>("Email") | ||
.IsRequired() | ||
.HasMaxLength(100) | ||
.HasColumnType("nvarchar(100)"); | ||
|
||
b.Property<string>("FirstName") | ||
.IsRequired() | ||
.HasMaxLength(100) | ||
.HasColumnType("nvarchar(100)"); | ||
|
||
b.Property<string>("Password") | ||
.IsRequired() | ||
.HasMaxLength(2000) | ||
.HasColumnType("nvarchar(2000)"); | ||
|
||
b.Property<string>("Surname") | ||
.IsRequired() | ||
.HasMaxLength(100) | ||
.HasColumnType("nvarchar(100)"); | ||
|
||
b.Property<DateTime?>("Updated") | ||
.HasColumnType("datetime2"); | ||
|
||
b.HasKey("Id"); | ||
|
||
b.HasIndex("Email") | ||
.IsUnique(); | ||
|
||
b.ToTable("Customer", (string)null); | ||
}); | ||
#pragma warning restore 612, 618 | ||
} | ||
} | ||
} |