- Timestamp:
- 01/26/21 10:33:09 (4 years ago)
- Branches:
- master
- Children:
- 7d80751
- Parents:
- 8e74e2f
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoData/Migrations/20210124191844_InitialMigration.cs
r8e74e2f rdb484c9 15 15 Id = table.Column<int>(nullable: false) 16 16 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), 17 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),17 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"), 18 18 DeletedOn = table.Column<DateTime>(nullable: true), 19 19 Name = table.Column<string>(nullable: false), … … 27 27 { 28 28 table.PrimaryKey("PK_HealthFacilities", x => x.Id); 29 }); 30 31 migrationBuilder.CreateTable( 32 name: "Medicines", 33 columns: table => new 34 { 35 Id = table.Column<int>(nullable: false) 36 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), 37 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"), 38 DeletedOn = table.Column<DateTime>(nullable: true), 39 Name = table.Column<string>(nullable: false), 40 Strength = table.Column<string>(nullable: false), 41 Form = table.Column<string>(nullable: true), 42 WayOfIssuing = table.Column<string>(nullable: false), 43 Manufacturer = table.Column<string>(nullable: false), 44 Price = table.Column<float>(nullable: false), 45 Packaging = table.Column<string>(nullable: true) 46 }, 47 constraints: table => 48 { 49 table.PrimaryKey("PK_Medicines", x => x.Id); 29 50 }); 30 51 … … 52 73 53 74 migrationBuilder.CreateTable( 54 name: "PharmacyHeads",55 columns: table => new56 {57 Id = table.Column<int>(nullable: false)58 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),59 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),60 DeletedOn = table.Column<DateTime>(nullable: true),61 Email = table.Column<string>(nullable: false),62 Name = table.Column<string>(nullable: false),63 Password = table.Column<string>(nullable: false)64 },65 constraints: table =>66 {67 table.PrimaryKey("PK_PharmacyHeads", x => x.Id);68 });69 70 migrationBuilder.CreateTable(71 75 name: "Users", 72 76 columns: table => new … … 111 115 112 116 migrationBuilder.CreateTable( 113 name: "Medicines", 114 columns: table => new 115 { 116 Id = table.Column<int>(nullable: false) 117 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), 118 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"), 119 DeletedOn = table.Column<DateTime>(nullable: true), 120 Name = table.Column<string>(nullable: false), 121 Strength = table.Column<string>(nullable: false), 122 Form = table.Column<string>(nullable: true), 123 WayOfIssuing = table.Column<string>(nullable: false), 124 Manufacturer = table.Column<string>(nullable: false), 125 Price = table.Column<float>(nullable: false), 126 Packaging = table.Column<string>(nullable: true), 127 PharmacyHeadId = table.Column<int>(nullable: true) 128 }, 129 constraints: table => 130 { 131 table.PrimaryKey("PK_Medicines", x => x.Id); 132 table.ForeignKey( 133 name: "FK_Medicines_PharmacyHeads_PharmacyHeadId", 134 column: x => x.PharmacyHeadId, 135 principalTable: "PharmacyHeads", 117 name: "PharmacyHeads", 118 columns: table => new 119 { 120 Id = table.Column<int>(nullable: false) 121 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), 122 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"), 123 DeletedOn = table.Column<DateTime>(nullable: true), 124 Email = table.Column<string>(nullable: false), 125 Name = table.Column<string>(nullable: false), 126 Password = table.Column<string>(nullable: false), 127 UserId = table.Column<int>(nullable: true) 128 }, 129 constraints: table => 130 { 131 table.PrimaryKey("PK_PharmacyHeads", x => x.Id); 132 table.ForeignKey( 133 name: "FK_PharmacyHeads_Users_UserId", 134 column: x => x.UserId, 135 principalTable: "Users", 136 136 principalColumn: "Id", 137 137 onDelete: ReferentialAction.Restrict); … … 150 150 Address = table.Column<string>(nullable: false), 151 151 WorkAllTime = table.Column<bool>(nullable: false), 152 PheadId = table.Column<int>(nullable: false) 152 PheadId = table.Column<int>(nullable: false), 153 PharmacyHeadId = table.Column<int>(nullable: true) 153 154 }, 154 155 constraints: table => … … 156 157 table.PrimaryKey("PK_Pharmacies", x => x.Id); 157 158 table.ForeignKey( 158 name: "FK_Pharmacies_PharmacyHeads_Ph eadId",159 column: x => x.Ph eadId,159 name: "FK_Pharmacies_PharmacyHeads_PharmacyHeadId", 160 column: x => x.PharmacyHeadId, 160 161 principalTable: "PharmacyHeads", 161 162 principalColumn: "Id", 162 onDelete: ReferentialAction. Cascade);163 onDelete: ReferentialAction.Restrict); 163 164 }); 164 165 … … 167 168 columns: table => new 168 169 { 170 Id = table.Column<int>(nullable: false) 171 .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), 172 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"), 173 DeletedOn = table.Column<DateTime>(nullable: true), 169 174 PheadId = table.Column<int>(nullable: false), 170 MedicineId = table.Column<int>(nullable: false), 171 Id = table.Column<int>(nullable: false), 172 CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"), 173 DeletedOn = table.Column<DateTime>(nullable: true) 174 }, 175 constraints: table => 176 { 177 table.PrimaryKey("PK_PharmacyHeadMedicines", x => new { x.PheadId, x.MedicineId }); 175 HeadId = table.Column<int>(nullable: true), 176 MedicineId = table.Column<int>(nullable: false) 177 }, 178 constraints: table => 179 { 180 table.PrimaryKey("PK_PharmacyHeadMedicines", x => x.Id); 181 table.ForeignKey( 182 name: "FK_PharmacyHeadMedicines_PharmacyHeads_HeadId", 183 column: x => x.HeadId, 184 principalTable: "PharmacyHeads", 185 principalColumn: "Id", 186 onDelete: ReferentialAction.Restrict); 178 187 table.ForeignKey( 179 188 name: "FK_PharmacyHeadMedicines_Medicines_MedicineId", … … 182 191 principalColumn: "Id", 183 192 onDelete: ReferentialAction.Cascade); 184 table.ForeignKey(185 name: "FK_PharmacyHeadMedicines_PharmacyHeads_PheadId",186 column: x => x.PheadId,187 principalTable: "PharmacyHeads",188 principalColumn: "Id",189 onDelete: ReferentialAction.Cascade);190 193 }); 191 194 … … 224 227 225 228 migrationBuilder.CreateIndex( 226 name: "IX_ Medicines_PharmacyHeadId",227 table: " Medicines",229 name: "IX_Pharmacies_PharmacyHeadId", 230 table: "Pharmacies", 228 231 column: "PharmacyHeadId"); 229 232 230 233 migrationBuilder.CreateIndex( 231 name: "IX_Pharmac ies_PheadId",232 table: "Pharmac ies",233 column: " PheadId");234 name: "IX_PharmacyHeadMedicines_HeadId", 235 table: "PharmacyHeadMedicines", 236 column: "HeadId"); 234 237 235 238 migrationBuilder.CreateIndex( … … 237 240 table: "PharmacyHeadMedicines", 238 241 column: "MedicineId"); 242 243 migrationBuilder.CreateIndex( 244 name: "IX_PharmacyHeads_UserId", 245 table: "PharmacyHeads", 246 column: "UserId"); 239 247 240 248 migrationBuilder.CreateIndex( … … 264 272 265 273 migrationBuilder.DropTable( 274 name: "HealthFacilities"); 275 276 migrationBuilder.DropTable( 277 name: "Medicines"); 278 279 migrationBuilder.DropTable( 280 name: "Pharmacies"); 281 282 migrationBuilder.DropTable( 283 name: "PharmacyHeads"); 284 285 migrationBuilder.DropTable( 266 286 name: "Users"); 267 268 migrationBuilder.DropTable(269 name: "HealthFacilities");270 271 migrationBuilder.DropTable(272 name: "Medicines");273 274 migrationBuilder.DropTable(275 name: "Pharmacies");276 277 migrationBuilder.DropTable(278 name: "PharmacyHeads");279 287 } 280 288 }
Note:
See TracChangeset
for help on using the changeset viewer.