using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace DamageAssesment.Api.Questions.Migrations { /// public partial class InitialQuestion : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "QuestionCategories", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CategoryName = table.Column(type: "nvarchar(max)", nullable: false), CategoryImage = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_QuestionCategories", x => x.Id); }); migrationBuilder.CreateTable( name: "QuestionsTranslations", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), QuestionId = table.Column(type: "int", nullable: false), QuestionText = table.Column(type: "nvarchar(max)", nullable: false), Language = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_QuestionsTranslations", x => x.Id); }); migrationBuilder.CreateTable( name: "QuestionTypes", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), TypeText = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_QuestionTypes", x => x.Id); }); migrationBuilder.CreateTable( name: "Questions", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), QuestionTypeId = table.Column(type: "int", nullable: false), QuestionNumber = table.Column(type: "int", nullable: false), IsRequired = table.Column(type: "bit", nullable: false), Comment = table.Column(type: "bit", nullable: false), Key = table.Column(type: "bit", nullable: false), SurveyId = table.Column(type: "int", nullable: true), QuestionGroup = table.Column(type: "nvarchar(max)", nullable: false), CategoryId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Questions", x => x.Id); table.ForeignKey( name: "FK_Questions_QuestionTypes_QuestionTypeId", column: x => x.QuestionTypeId, principalTable: "QuestionTypes", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Questions_QuestionTypeId", table: "Questions", column: "QuestionTypeId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "QuestionCategories"); migrationBuilder.DropTable( name: "Questions"); migrationBuilder.DropTable( name: "QuestionsTranslations"); migrationBuilder.DropTable( name: "QuestionTypes"); } } }