using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace DataModel.Migrations { public partial class _202206AddMainEntities : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Sections", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: false), ParentId = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Sections", x => x.Id); table.ForeignKey( name: "FK_Sections_Sections_ParentId", column: x => x.ParentId, principalTable: "Sections", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "TextElements", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Code = table.Column(type: "TEXT", nullable: false), SectionId = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TextElements", x => x.Id); table.ForeignKey( name: "FK_TextElements_Sections_SectionId", column: x => x.SectionId, principalTable: "Sections", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Translations", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), TextElementId = table.Column(type: "INTEGER", nullable: false), Culture = table.Column(type: "TEXT", nullable: false), Text = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Translations", x => x.Id); table.ForeignKey( name: "FK_Translations_TextElements_TextElementId", column: x => x.TextElementId, principalTable: "TextElements", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Sections_Id", table: "Sections", column: "Id"); migrationBuilder.CreateIndex( name: "IX_Sections_Name", table: "Sections", column: "Name"); migrationBuilder.CreateIndex( name: "IX_Sections_ParentId", table: "Sections", column: "ParentId"); migrationBuilder.CreateIndex( name: "IX_TextElements_Code", table: "TextElements", column: "Code"); migrationBuilder.CreateIndex( name: "IX_TextElements_Id", table: "TextElements", column: "Id"); migrationBuilder.CreateIndex( name: "IX_TextElements_SectionId", table: "TextElements", column: "SectionId"); migrationBuilder.CreateIndex( name: "IX_Translations_Culture", table: "Translations", column: "Culture"); migrationBuilder.CreateIndex( name: "IX_Translations_Id", table: "Translations", column: "Id"); migrationBuilder.CreateIndex( name: "IX_Translations_Text", table: "Translations", column: "Text"); migrationBuilder.CreateIndex( name: "IX_Translations_TextElementId", table: "Translations", column: "TextElementId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Translations"); migrationBuilder.DropTable( name: "TextElements"); migrationBuilder.DropTable( name: "Sections"); } } }