-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e84506
commit d16ff66
Showing
15 changed files
with
348 additions
and
33 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
68 changes: 68 additions & 0 deletions
68
examples/Demo.DbMigrator/Migrations/20200926034223_InitialCreate.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
examples/Demo.DbMigrator/Migrations/20200926034223_InitialCreate.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,50 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
namespace Demo.DbMigrator.Migrations | ||
{ | ||
public partial class InitialCreate : Migration | ||
{ | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "Order", | ||
columns: table => new | ||
{ | ||
Id = table.Column<Guid>(nullable: false), | ||
DateTime = table.Column<DateTime>(nullable: false) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Order", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "OrderItem", | ||
columns: table => new | ||
{ | ||
Id = table.Column<Guid>(nullable: false), | ||
OrderId = table.Column<Guid>(nullable: false), | ||
Name = table.Column<string>(nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_OrderItem", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_OrderItem_OrderId", | ||
table: "OrderItem", | ||
column: "OrderId"); | ||
} | ||
|
||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "OrderItem"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "Order"); | ||
} | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
examples/Demo.DbMigrator/Migrations/CustomContextModelSnapshot.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,66 @@ | ||
// <auto-generated /> | ||
using System; | ||
using DbMigrator; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; | ||
|
||
namespace Demo.DbMigrator.Migrations | ||
{ | ||
[DbContext(typeof(CustomContext))] | ||
partial class CustomContextModelSnapshot : ModelSnapshot | ||
{ | ||
protected override void BuildModel(ModelBuilder modelBuilder) | ||
{ | ||
#pragma warning disable 612, 618 | ||
modelBuilder | ||
.HasAnnotation("ProductVersion", "3.1.8") | ||
.HasAnnotation("Relational:MaxIdentifierLength", 128) | ||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | ||
|
||
modelBuilder.Entity("Demo.DbMigrator.Order", b => | ||
{ | ||
b.Property<Guid>("Id") | ||
.ValueGeneratedOnAdd() | ||
.HasColumnType("uniqueidentifier"); | ||
|
||
b.Property<DateTime>("DateTime") | ||
.HasColumnType("datetime2"); | ||
|
||
b.HasKey("Id"); | ||
|
||
b.ToTable("Order"); | ||
}); | ||
|
||
modelBuilder.Entity("Demo.DbMigrator.OrderItem", b => | ||
{ | ||
b.Property<Guid>("Id") | ||
.ValueGeneratedOnAdd() | ||
.HasColumnType("uniqueidentifier"); | ||
|
||
b.Property<string>("Name") | ||
.HasColumnType("nvarchar(max)"); | ||
|
||
b.Property<Guid>("OrderId") | ||
.HasColumnType("uniqueidentifier"); | ||
|
||
b.HasKey("Id"); | ||
|
||
b.HasIndex("OrderId"); | ||
|
||
b.ToTable("OrderItem"); | ||
}); | ||
|
||
modelBuilder.Entity("Demo.DbMigrator.OrderItem", b => | ||
{ | ||
b.HasOne("Demo.DbMigrator.Order", null) | ||
.WithMany("OrderItems") | ||
.HasForeignKey("OrderId") | ||
.OnDelete(DeleteBehavior.Cascade) | ||
.IsRequired(); | ||
}); | ||
#pragma warning restore 612, 618 | ||
} | ||
} | ||
} |
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 @@ | ||
{"Name":"Order","Schema":null,"PrimaryKey":{"Schema":null,"Table":"Order","Name":"PK_Order","Columns":["Id"],"IsDestructiveChange":false},"Columns":[{"Name":"Id","Schema":null,"Table":"Order","ClrType":"System.Guid, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","ColumnType":null,"IsUnicode":null,"IsFixedLength":false,"MaxLength":null,"IsRowVersion":false,"IsNullable":false,"DefaultValue":null,"DefaultValueSql":null,"ComputedColumnSql":null,"Comment":null,"IsDestructiveChange":false},{"Name":"DateTime","Schema":null,"Table":"Order","ClrType":"System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","ColumnType":null,"IsUnicode":null,"IsFixedLength":false,"MaxLength":null,"IsRowVersion":false,"IsNullable":false,"DefaultValue":null,"DefaultValueSql":null,"ComputedColumnSql":null,"Comment":null,"IsDestructiveChange":false}],"ForeignKeys":[],"UniqueConstraints":[],"CheckConstraints":[],"Comment":null,"IsDestructiveChange":false}{"Name":"OrderItem","Schema":null,"PrimaryKey":{"Schema":null,"Table":"OrderItem","Name":"PK_OrderItem","Columns":["Id"],"IsDestructiveChange":false},"Columns":[{"Name":"Id","Schema":null,"Table":"OrderItem","ClrType":"System.Guid, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","ColumnType":null,"IsUnicode":null,"IsFixedLength":false,"MaxLength":null,"IsRowVersion":false,"IsNullable":false,"DefaultValue":null,"DefaultValueSql":null,"ComputedColumnSql":null,"Comment":null,"IsDestructiveChange":false},{"Name":"OrderId","Schema":null,"Table":"OrderItem","ClrType":"System.Guid, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","ColumnType":null,"IsUnicode":null,"IsFixedLength":false,"MaxLength":null,"IsRowVersion":false,"IsNullable":false,"DefaultValue":null,"DefaultValueSql":null,"ComputedColumnSql":null,"Comment":null,"IsDestructiveChange":false},{"Name":"Name","Schema":null,"Table":"OrderItem","ClrType":"System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","ColumnType":null,"IsUnicode":null,"IsFixedLength":false,"MaxLength":null,"IsRowVersion":false,"IsNullable":true,"DefaultValue":null,"DefaultValueSql":null,"ComputedColumnSql":null,"Comment":null,"IsDestructiveChange":false}],"ForeignKeys":[],"UniqueConstraints":[],"CheckConstraints":[],"Comment":null,"IsDestructiveChange":false} |
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.