Created
July 23, 2021 23:57
-
-
Save manoj-choudhari-git/6a051f748d56336ee787b50560d61a05 to your computer and use it in GitHub Desktop.
.NET - Entity Framework Core - Migration File
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
public partial class InitialCreate : Migration | |
{ | |
protected override void Up(MigrationBuilder migrationBuilder) | |
{ | |
migrationBuilder.CreateTable( | |
name: "Students", | |
columns: table => new | |
{ | |
Id = table.Column<int>(type: "int", nullable: false) | |
.Annotation("SqlServer:Identity", "1, 1"), | |
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: true), | |
LastName = table.Column<string>(type: "nvarchar(max)", nullable: true), | |
Address = table.Column<string>(type: "nvarchar(max)", nullable: true), | |
Nationality = table.Column<string>(type: "nvarchar(max)", nullable: true), | |
CreatedOn = table.Column<DateTime>(type: "datetime2", nullable: false), | |
ModifiedOn = table.Column<DateTime>(type: "datetime2", nullable: false), | |
IsDeleted = table.Column<bool>(type: "bit", nullable: false), | |
DeletedOn = table.Column<DateTime>(type: "datetime2", nullable: false) | |
}, | |
constraints: table => | |
{ | |
table.PrimaryKey("PK_Students", x => x.Id); | |
}); | |
} | |
protected override void Down(MigrationBuilder migrationBuilder) | |
{ | |
migrationBuilder.DropTable( | |
name: "Students"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment