using System; using Microsoft.EntityFrameworkCore.Migrations; namespace NugetTest.AspCore.Migrations { public partial class init : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "People", columns: table => new { PersonId = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), IsRemoved = table.Column(type: "bit", nullable: false), CreationTime = table.Column(type: "datetime2", nullable: false), RemoveTime = table.Column(type: "datetime2", nullable: false), FirstName = table.Column(type: "nvarchar(max)", nullable: true), FamilyName = table.Column(type: "nvarchar(max)", nullable: true), PersonId1 = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK_People", x => x.PersonId); table.ForeignKey( name: "FK_People_People_PersonId1", column: x => x.PersonId1, principalTable: "People", principalColumn: "PersonId", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Articles", columns: table => new { ArticleId = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), IsRemoved = table.Column(type: "bit", nullable: false), CreationTime = table.Column(type: "datetime2", nullable: false), RemoveTime = table.Column(type: "datetime2", nullable: false), Content = table.Column(type: "nvarchar(max)", nullable: true), PersonId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Articles", x => x.ArticleId); table.ForeignKey( name: "FK_Articles_People_PersonId", column: x => x.PersonId, principalTable: "People", principalColumn: "PersonId", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_Articles_PersonId", table: "Articles", column: "PersonId"); migrationBuilder.CreateIndex( name: "IX_People_PersonId1", table: "People", column: "PersonId1"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Articles"); migrationBuilder.DropTable( name: "People"); } } }