Skip to content

Instantly share code, notes, and snippets.

@nishanc
Created May 3, 2021 19:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save nishanc/f0f5befa8064b03893787b1900dda46c to your computer and use it in GitHub Desktop.
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TPTUsers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Username = table.Column<string>(type: "nvarchar(max)", nullable: true),
Email = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TPTUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "TPTStudents",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false),
CGPA = table.Column<string>(type: "nvarchar(max)", nullable: true),
Major = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TPTStudents", x => x.Id);
table.ForeignKey(
name: "FK_TPTStudents_TPTUsers_Id",
column: x => x.Id,
principalTable: "TPTUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "TPTTeachers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false),
Designation = table.Column<string>(type: "nvarchar(max)", nullable: true),
Speciality = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TPTTeachers", x => x.Id);
table.ForeignKey(
name: "FK_TPTTeachers_TPTUsers_Id",
column: x => x.Id,
principalTable: "TPTUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment