Add initial database context and first entity
This commit is contained in:
40
Data/Migrations/20220603063002_Initial.cs
Normal file
40
Data/Migrations/20220603063002_Initial.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Diary.Data.Migrations
|
||||
{
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "Diary");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Entries",
|
||||
schema: "Diary",
|
||||
columns: table => new
|
||||
{
|
||||
EnrtyID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Date = table.Column<DateTime>(type: "Date", nullable: false),
|
||||
ValidFrom = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
ValidTo = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
Note = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Entries", x => x.EnrtyID);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Entries",
|
||||
schema: "Diary");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user