Ignore:
Timestamp:
01/26/21 10:33:09 (3 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
7d80751
Parents:
8e74e2f
Message:

Fix bugs

File:
1 moved

Legend:

Unmodified
Added
Removed
  • FarmatikoData/Migrations/20210124191844_InitialMigration.cs

    r8e74e2f rdb484c9  
    1515                    Id = table.Column<int>(nullable: false)
    1616                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
    17                     CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql:"now()"),
     17                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
    1818                    DeletedOn = table.Column<DateTime>(nullable: true),
    1919                    Name = table.Column<string>(nullable: false),
     
    2727                {
    2828                    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);
    2950                });
    3051
     
    5273
    5374            migrationBuilder.CreateTable(
    54                 name: "PharmacyHeads",
    55                 columns: table => new
    56                 {
    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(
    7175                name: "Users",
    7276                columns: table => new
     
    111115
    112116            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",
    136136                        principalColumn: "Id",
    137137                        onDelete: ReferentialAction.Restrict);
     
    150150                    Address = table.Column<string>(nullable: false),
    151151                    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)
    153154                },
    154155                constraints: table =>
     
    156157                    table.PrimaryKey("PK_Pharmacies", x => x.Id);
    157158                    table.ForeignKey(
    158                         name: "FK_Pharmacies_PharmacyHeads_PheadId",
    159                         column: x => x.PheadId,
     159                        name: "FK_Pharmacies_PharmacyHeads_PharmacyHeadId",
     160                        column: x => x.PharmacyHeadId,
    160161                        principalTable: "PharmacyHeads",
    161162                        principalColumn: "Id",
    162                         onDelete: ReferentialAction.Cascade);
     163                        onDelete: ReferentialAction.Restrict);
    163164                });
    164165
     
    167168                columns: table => new
    168169                {
     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),
    169174                    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);
    178187                    table.ForeignKey(
    179188                        name: "FK_PharmacyHeadMedicines_Medicines_MedicineId",
     
    182191                        principalColumn: "Id",
    183192                        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);
    190193                });
    191194
     
    224227
    225228            migrationBuilder.CreateIndex(
    226                 name: "IX_Medicines_PharmacyHeadId",
    227                 table: "Medicines",
     229                name: "IX_Pharmacies_PharmacyHeadId",
     230                table: "Pharmacies",
    228231                column: "PharmacyHeadId");
    229232
    230233            migrationBuilder.CreateIndex(
    231                 name: "IX_Pharmacies_PheadId",
    232                 table: "Pharmacies",
    233                 column: "PheadId");
     234                name: "IX_PharmacyHeadMedicines_HeadId",
     235                table: "PharmacyHeadMedicines",
     236                column: "HeadId");
    234237
    235238            migrationBuilder.CreateIndex(
     
    237240                table: "PharmacyHeadMedicines",
    238241                column: "MedicineId");
     242
     243            migrationBuilder.CreateIndex(
     244                name: "IX_PharmacyHeads_UserId",
     245                table: "PharmacyHeads",
     246                column: "UserId");
    239247
    240248            migrationBuilder.CreateIndex(
     
    264272
    265273            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(
    266286                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");
    279287        }
    280288    }
Note: See TracChangeset for help on using the changeset viewer.