Created
May 3, 2021 19:54
-
-
Save nishanc/f0f5befa8064b03893787b1900dda46c to your computer and use it in GitHub Desktop.
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
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