|
| 1 | +using Microsoft.EntityFrameworkCore.Migrations; |
| 2 | + |
| 3 | +namespace Infrastructure.Data.Migrations |
| 4 | +{ |
| 5 | + public partial class renametemplates : Migration |
| 6 | + { |
| 7 | + protected override void Up(MigrationBuilder migrationBuilder) |
| 8 | + { |
| 9 | + migrationBuilder.DropForeignKey( |
| 10 | + name: "FK_IngredientTemplates_ProductTemplates_ProductId", |
| 11 | + table: "IngredientTemplates"); |
| 12 | + |
| 13 | + migrationBuilder.DropForeignKey( |
| 14 | + name: "FK_ProductTemplates_ProductCategories_ProductCategoryId", |
| 15 | + table: "ProductTemplates"); |
| 16 | + |
| 17 | + migrationBuilder.DropForeignKey( |
| 18 | + name: "FK_ProductTemplates_ProductPackTemplates_ProductPackId", |
| 19 | + table: "ProductTemplates"); |
| 20 | + |
| 21 | + migrationBuilder.DropPrimaryKey( |
| 22 | + name: "PK_ProductTemplates", |
| 23 | + table: "ProductTemplates"); |
| 24 | + |
| 25 | + migrationBuilder.DropPrimaryKey( |
| 26 | + name: "PK_ProductPackTemplates", |
| 27 | + table: "ProductPackTemplates"); |
| 28 | + |
| 29 | + migrationBuilder.DropPrimaryKey( |
| 30 | + name: "PK_IngredientTemplates", |
| 31 | + table: "IngredientTemplates"); |
| 32 | + |
| 33 | + migrationBuilder.RenameTable( |
| 34 | + name: "ProductTemplates", |
| 35 | + newName: "MenuProducts"); |
| 36 | + |
| 37 | + migrationBuilder.RenameTable( |
| 38 | + name: "ProductPackTemplates", |
| 39 | + newName: "MenuProductPacks"); |
| 40 | + |
| 41 | + migrationBuilder.RenameTable( |
| 42 | + name: "IngredientTemplates", |
| 43 | + newName: "MenuIngredients"); |
| 44 | + |
| 45 | + migrationBuilder.RenameIndex( |
| 46 | + name: "IX_ProductTemplates_ProductPackId", |
| 47 | + table: "MenuProducts", |
| 48 | + newName: "IX_MenuProducts_ProductPackId"); |
| 49 | + |
| 50 | + migrationBuilder.RenameIndex( |
| 51 | + name: "IX_ProductTemplates_ProductCategoryId", |
| 52 | + table: "MenuProducts", |
| 53 | + newName: "IX_MenuProducts_ProductCategoryId"); |
| 54 | + |
| 55 | + migrationBuilder.RenameIndex( |
| 56 | + name: "IX_IngredientTemplates_ProductId", |
| 57 | + table: "MenuIngredients", |
| 58 | + newName: "IX_MenuIngredients_ProductId"); |
| 59 | + |
| 60 | + migrationBuilder.AddPrimaryKey( |
| 61 | + name: "PK_MenuProducts", |
| 62 | + table: "MenuProducts", |
| 63 | + column: "Id"); |
| 64 | + |
| 65 | + migrationBuilder.AddPrimaryKey( |
| 66 | + name: "PK_MenuProductPacks", |
| 67 | + table: "MenuProductPacks", |
| 68 | + column: "Id"); |
| 69 | + |
| 70 | + migrationBuilder.AddPrimaryKey( |
| 71 | + name: "PK_MenuIngredients", |
| 72 | + table: "MenuIngredients", |
| 73 | + column: "Id"); |
| 74 | + |
| 75 | + migrationBuilder.AddForeignKey( |
| 76 | + name: "FK_MenuIngredients_MenuProducts_ProductId", |
| 77 | + table: "MenuIngredients", |
| 78 | + column: "ProductId", |
| 79 | + principalTable: "MenuProducts", |
| 80 | + principalColumn: "Id", |
| 81 | + onDelete: ReferentialAction.Cascade); |
| 82 | + |
| 83 | + migrationBuilder.AddForeignKey( |
| 84 | + name: "FK_MenuProducts_MenuProductPacks_ProductPackId", |
| 85 | + table: "MenuProducts", |
| 86 | + column: "ProductPackId", |
| 87 | + principalTable: "MenuProductPacks", |
| 88 | + principalColumn: "Id", |
| 89 | + onDelete: ReferentialAction.Cascade); |
| 90 | + |
| 91 | + migrationBuilder.AddForeignKey( |
| 92 | + name: "FK_MenuProducts_ProductCategories_ProductCategoryId", |
| 93 | + table: "MenuProducts", |
| 94 | + column: "ProductCategoryId", |
| 95 | + principalTable: "ProductCategories", |
| 96 | + principalColumn: "Id", |
| 97 | + onDelete: ReferentialAction.Cascade); |
| 98 | + } |
| 99 | + |
| 100 | + protected override void Down(MigrationBuilder migrationBuilder) |
| 101 | + { |
| 102 | + migrationBuilder.DropForeignKey( |
| 103 | + name: "FK_MenuIngredients_MenuProducts_ProductId", |
| 104 | + table: "MenuIngredients"); |
| 105 | + |
| 106 | + migrationBuilder.DropForeignKey( |
| 107 | + name: "FK_MenuProducts_MenuProductPacks_ProductPackId", |
| 108 | + table: "MenuProducts"); |
| 109 | + |
| 110 | + migrationBuilder.DropForeignKey( |
| 111 | + name: "FK_MenuProducts_ProductCategories_ProductCategoryId", |
| 112 | + table: "MenuProducts"); |
| 113 | + |
| 114 | + migrationBuilder.DropPrimaryKey( |
| 115 | + name: "PK_MenuProducts", |
| 116 | + table: "MenuProducts"); |
| 117 | + |
| 118 | + migrationBuilder.DropPrimaryKey( |
| 119 | + name: "PK_MenuProductPacks", |
| 120 | + table: "MenuProductPacks"); |
| 121 | + |
| 122 | + migrationBuilder.DropPrimaryKey( |
| 123 | + name: "PK_MenuIngredients", |
| 124 | + table: "MenuIngredients"); |
| 125 | + |
| 126 | + migrationBuilder.RenameTable( |
| 127 | + name: "MenuProducts", |
| 128 | + newName: "ProductTemplates"); |
| 129 | + |
| 130 | + migrationBuilder.RenameTable( |
| 131 | + name: "MenuProductPacks", |
| 132 | + newName: "ProductPackTemplates"); |
| 133 | + |
| 134 | + migrationBuilder.RenameTable( |
| 135 | + name: "MenuIngredients", |
| 136 | + newName: "IngredientTemplates"); |
| 137 | + |
| 138 | + migrationBuilder.RenameIndex( |
| 139 | + name: "IX_MenuProducts_ProductPackId", |
| 140 | + table: "ProductTemplates", |
| 141 | + newName: "IX_ProductTemplates_ProductPackId"); |
| 142 | + |
| 143 | + migrationBuilder.RenameIndex( |
| 144 | + name: "IX_MenuProducts_ProductCategoryId", |
| 145 | + table: "ProductTemplates", |
| 146 | + newName: "IX_ProductTemplates_ProductCategoryId"); |
| 147 | + |
| 148 | + migrationBuilder.RenameIndex( |
| 149 | + name: "IX_MenuIngredients_ProductId", |
| 150 | + table: "IngredientTemplates", |
| 151 | + newName: "IX_IngredientTemplates_ProductId"); |
| 152 | + |
| 153 | + migrationBuilder.AddPrimaryKey( |
| 154 | + name: "PK_ProductTemplates", |
| 155 | + table: "ProductTemplates", |
| 156 | + column: "Id"); |
| 157 | + |
| 158 | + migrationBuilder.AddPrimaryKey( |
| 159 | + name: "PK_ProductPackTemplates", |
| 160 | + table: "ProductPackTemplates", |
| 161 | + column: "Id"); |
| 162 | + |
| 163 | + migrationBuilder.AddPrimaryKey( |
| 164 | + name: "PK_IngredientTemplates", |
| 165 | + table: "IngredientTemplates", |
| 166 | + column: "Id"); |
| 167 | + |
| 168 | + migrationBuilder.AddForeignKey( |
| 169 | + name: "FK_IngredientTemplates_ProductTemplates_ProductId", |
| 170 | + table: "IngredientTemplates", |
| 171 | + column: "ProductId", |
| 172 | + principalTable: "ProductTemplates", |
| 173 | + principalColumn: "Id", |
| 174 | + onDelete: ReferentialAction.Cascade); |
| 175 | + |
| 176 | + migrationBuilder.AddForeignKey( |
| 177 | + name: "FK_ProductTemplates_ProductCategories_ProductCategoryId", |
| 178 | + table: "ProductTemplates", |
| 179 | + column: "ProductCategoryId", |
| 180 | + principalTable: "ProductCategories", |
| 181 | + principalColumn: "Id", |
| 182 | + onDelete: ReferentialAction.Cascade); |
| 183 | + |
| 184 | + migrationBuilder.AddForeignKey( |
| 185 | + name: "FK_ProductTemplates_ProductPackTemplates_ProductPackId", |
| 186 | + table: "ProductTemplates", |
| 187 | + column: "ProductPackId", |
| 188 | + principalTable: "ProductPackTemplates", |
| 189 | + principalColumn: "Id", |
| 190 | + onDelete: ReferentialAction.Cascade); |
| 191 | + } |
| 192 | + } |
| 193 | +} |
0 commit comments