Ignore:
Timestamp:
11/14/20 12:27:30 (3 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
68454c6
Parents:
ad60966
Message:

Fix bugs, add some more

File:
1 moved

Legend:

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

    rad60966 r1db5673  
    1515                    Id = table.Column<int>(nullable: false)
    1616                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    17                     CreatedOn = table.Column<DateTime>(nullable: false),
     17                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
    1818                    DeletedOn = table.Column<DateTime>(nullable: true),
    1919                    Name = table.Column<string>(nullable: false),
     
    3030
    3131            migrationBuilder.CreateTable(
    32                 name: "Medicines",
    33                 columns: table => new
    34                 {
    35                     Id = table.Column<int>(nullable: false)
    36                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    37                     CreatedOn = table.Column<DateTime>(nullable: false),
    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);
    50                 });
    51 
    52             migrationBuilder.CreateTable(
    5332                name: "Pandemics",
    5433                columns: table => new
     
    5635                    Id = table.Column<int>(nullable: false)
    5736                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    58                     CreatedOn = table.Column<DateTime>(nullable: false),
     37                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
    5938                    DeletedOn = table.Column<DateTime>(nullable: true),
    6039                    Name = table.Column<string>(nullable: false),
     
    7857                    Id = table.Column<int>(nullable: false)
    7958                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    80                     CreatedOn = table.Column<DateTime>(nullable: false),
     59                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
    8160                    DeletedOn = table.Column<DateTime>(nullable: true),
    8261                    Email = table.Column<string>(nullable: false),
     
    9574                    Id = table.Column<int>(nullable: false)
    9675                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    97                     CreatedOn = table.Column<DateTime>(nullable: false),
    98                     DeletedOn = table.Column<DateTime>(nullable: true),
    99                     Name = table.Column<string>(nullable: true),
    100                     Email = table.Column<string>(nullable: true),
    101                     Password = table.Column<string>(nullable: true),
     76                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
     77                    DeletedOn = table.Column<DateTime>(nullable: true),
     78                    Name = table.Column<string>(nullable: false),
     79                    Email = table.Column<string>(nullable: false),
     80                    Password = table.Column<string>(nullable: false),
    10281                    UserRole = table.Column<int>(nullable: false)
    10382                },
     
    11392                    Id = table.Column<int>(nullable: false)
    11493                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    115                     CreatedOn = table.Column<DateTime>(nullable: false),
     94                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
    11695                    DeletedOn = table.Column<DateTime>(nullable: true),
    11796                    Name = table.Column<string>(nullable: false),
     
    132111
    133112            migrationBuilder.CreateTable(
    134                 name: "MedicineList",
    135                 columns: table => new
    136                 {
    137                     Id = table.Column<int>(nullable: false)
    138                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    139                     CreatedOn = table.Column<DateTime>(nullable: false),
    140                     DeletedOn = table.Column<DateTime>(nullable: true),
    141                     MedicineId = table.Column<int>(nullable: false),
    142                     HasMedicine = table.Column<bool>(nullable: false),
     113                name: "Medicines",
     114                columns: table => new
     115                {
     116                    Id = table.Column<int>(nullable: false)
     117                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
     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),
    143127                    PharmacyHeadId = table.Column<int>(nullable: true)
    144128                },
    145129                constraints: table =>
    146130                {
    147                     table.PrimaryKey("PK_MedicineList", x => x.Id);
    148                     table.ForeignKey(
    149                         name: "FK_MedicineList_Medicines_MedicineId",
    150                         column: x => x.MedicineId,
    151                         principalTable: "Medicines",
    152                         principalColumn: "Id",
    153                         onDelete: ReferentialAction.Cascade);
    154                     table.ForeignKey(
    155                         name: "FK_MedicineList_PharmacyHeads_PharmacyHeadId",
     131                    table.PrimaryKey("PK_Medicines", x => x.Id);
     132                    table.ForeignKey(
     133                        name: "FK_Medicines_PharmacyHeads_PharmacyHeadId",
    156134                        column: x => x.PharmacyHeadId,
    157135                        principalTable: "PharmacyHeads",
     
    172150                    Address = table.Column<string>(nullable: false),
    173151                    WorkAllTime = table.Column<bool>(nullable: false),
    174                     PharmacyHeadId = table.Column<int>(nullable: true)
     152                    PheadId = table.Column<int>(nullable: false)
    175153                },
    176154                constraints: table =>
     
    178156                    table.PrimaryKey("PK_Pharmacies", x => x.Id);
    179157                    table.ForeignKey(
    180                         name: "FK_Pharmacies_PharmacyHeads_PharmacyHeadId",
    181                         column: x => x.PharmacyHeadId,
    182                         principalTable: "PharmacyHeads",
    183                         principalColumn: "Id",
    184                         onDelete: ReferentialAction.Restrict);
     158                        name: "FK_Pharmacies_PharmacyHeads_PheadId",
     159                        column: x => x.PheadId,
     160                        principalTable: "PharmacyHeads",
     161                        principalColumn: "Id",
     162                        onDelete: ReferentialAction.Cascade);
     163                });
     164
     165            migrationBuilder.CreateTable(
     166                name: "PharmacyHeadMedicines",
     167                columns: table => new
     168                {
     169                    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 });
     178                    table.ForeignKey(
     179                        name: "FK_PharmacyHeadMedicines_Medicines_MedicineId",
     180                        column: x => x.MedicineId,
     181                        principalTable: "Medicines",
     182                        principalColumn: "Id",
     183                        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);
    185190                });
    186191
     
    191196                    Id = table.Column<int>(nullable: false)
    192197                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    193                     CreatedOn = table.Column<DateTime>(nullable: false),
     198                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
    194199                    DeletedOn = table.Column<DateTime>(nullable: true),
    195200                    HeadId = table.Column<int>(nullable: false),
     
    219224
    220225            migrationBuilder.CreateIndex(
    221                 name: "IX_MedicineList_MedicineId",
    222                 table: "MedicineList",
     226                name: "IX_Medicines_PharmacyHeadId",
     227                table: "Medicines",
     228                column: "PharmacyHeadId");
     229
     230            migrationBuilder.CreateIndex(
     231                name: "IX_Pharmacies_PheadId",
     232                table: "Pharmacies",
     233                column: "PheadId");
     234
     235            migrationBuilder.CreateIndex(
     236                name: "IX_PharmacyHeadMedicines_MedicineId",
     237                table: "PharmacyHeadMedicines",
    223238                column: "MedicineId");
    224 
    225             migrationBuilder.CreateIndex(
    226                 name: "IX_MedicineList_PharmacyHeadId",
    227                 table: "MedicineList",
    228                 column: "PharmacyHeadId");
    229 
    230             migrationBuilder.CreateIndex(
    231                 name: "IX_Pharmacies_PharmacyHeadId",
    232                 table: "Pharmacies",
    233                 column: "PharmacyHeadId");
    234239
    235240            migrationBuilder.CreateIndex(
     
    250255
    251256            migrationBuilder.DropTable(
    252                 name: "MedicineList");
    253 
    254             migrationBuilder.DropTable(
    255257                name: "Pandemics");
     258
     259            migrationBuilder.DropTable(
     260                name: "PharmacyHeadMedicines");
    256261
    257262            migrationBuilder.DropTable(
Note: See TracChangeset for help on using the changeset viewer.