diff --git a/InventoryManagementSystem/Dockerfile b/InventoryManagementSystem/Dockerfile new file mode 100644 index 0000000..1c319b0 --- /dev/null +++ b/InventoryManagementSystem/Dockerfile @@ -0,0 +1,26 @@ +# Use the official .NET SDK image for building the application (targeting .NET 8) +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env +WORKDIR /app + +# Copy the project file and restore any dependencies (via NuGet) +COPY *.csproj ./ +RUN dotnet restore + +# Copy the entire source code and build the project +COPY . ./ +RUN dotnet publish -c Release -o out + +# Use the official .NET runtime image for running the app (targeting .NET 8) +FROM mcr.microsoft.com/dotnet/aspnet:8.0 +WORKDIR /app +COPY --from=build-env /app/out . + +# Set environment variables +ENV ASPNETCORE_URLS=http://+:5000 +ENV ASPNETCORE_ENVIRONMENT=Production + +# Expose the API port +EXPOSE 5000 + +# Run the app +ENTRYPOINT ["dotnet", "InventoryManagementSystem.dll"] diff --git a/InventoryManagementSystem/InventoryManagementSystem.csproj b/InventoryManagementSystem/InventoryManagementSystem.csproj index 4fd625b..68dc082 100644 --- a/InventoryManagementSystem/InventoryManagementSystem.csproj +++ b/InventoryManagementSystem/InventoryManagementSystem.csproj @@ -24,4 +24,8 @@ + + + + \ No newline at end of file diff --git a/InventoryManagementSystem/Migrations/20240905200818_InitialCreate.Designer.cs b/InventoryManagementSystem/Migrations/20240905200818_InitialCreate.Designer.cs deleted file mode 100644 index 32c5163..0000000 --- a/InventoryManagementSystem/Migrations/20240905200818_InitialCreate.Designer.cs +++ /dev/null @@ -1,115 +0,0 @@ -// -using InventoryManagementSystem.Models; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace InventoryManagementSystem.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20240905200818_InitialCreate")] - partial class InitialCreate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("InventoryManagementSystem.Models.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CategoryId")); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CategoryId"); - - b.ToTable("Category"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Product", b => - { - b.Property("ProductId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductId")); - - b.Property("CategoryId") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Price") - .HasColumnType("double"); - - b.Property("Quantity") - .HasColumnType("int"); - - b.HasKey("ProductId"); - - b.HasIndex("CategoryId"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Supplier", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("Address") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Phone") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Suppliers"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Product", b => - { - b.HasOne("InventoryManagementSystem.Models.Category", "Category") - .WithMany("Products") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Category", b => - { - b.Navigation("Products"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/InventoryManagementSystem/Migrations/20240905200818_InitialCreate.cs b/InventoryManagementSystem/Migrations/20240905200818_InitialCreate.cs deleted file mode 100644 index f2d12ff..0000000 --- a/InventoryManagementSystem/Migrations/20240905200818_InitialCreate.cs +++ /dev/null @@ -1,94 +0,0 @@ -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace InventoryManagementSystem.Migrations -{ - /// - public partial class InitialCreate : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterDatabase() - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "Category", - columns: table => new - { - CategoryId = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_Category", x => x.CategoryId); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "Suppliers", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Address = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Phone = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_Suppliers", x => x.Id); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "Products", - columns: table => new - { - ProductId = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Price = table.Column(type: "double", nullable: false), - Quantity = table.Column(type: "int", nullable: false), - CategoryId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Products", x => x.ProductId); - table.ForeignKey( - name: "FK_Products_Category_CategoryId", - column: x => x.CategoryId, - principalTable: "Category", - principalColumn: "CategoryId", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_Products_CategoryId", - table: "Products", - column: "CategoryId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Products"); - - migrationBuilder.DropTable( - name: "Suppliers"); - - migrationBuilder.DropTable( - name: "Category"); - } - } -} diff --git a/InventoryManagementSystem/Migrations/20240906183020_model_change.cs b/InventoryManagementSystem/Migrations/20240906183020_model_change.cs deleted file mode 100644 index 399693b..0000000 --- a/InventoryManagementSystem/Migrations/20240906183020_model_change.cs +++ /dev/null @@ -1,100 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace InventoryManagementSystem.Migrations -{ - /// - public partial class model_change : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Products_Category_CategoryId", - table: "Products"); - - migrationBuilder.DropPrimaryKey( - name: "PK_Category", - table: "Category"); - - migrationBuilder.RenameTable( - name: "Category", - newName: "Categories"); - - migrationBuilder.AddColumn( - name: "SupplierId", - table: "Products", - type: "int", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddPrimaryKey( - name: "PK_Categories", - table: "Categories", - column: "CategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_Products_SupplierId", - table: "Products", - column: "SupplierId"); - - migrationBuilder.AddForeignKey( - name: "FK_Products_Categories_CategoryId", - table: "Products", - column: "CategoryId", - principalTable: "Categories", - principalColumn: "CategoryId", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_Products_Suppliers_SupplierId", - table: "Products", - column: "SupplierId", - principalTable: "Suppliers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Products_Categories_CategoryId", - table: "Products"); - - migrationBuilder.DropForeignKey( - name: "FK_Products_Suppliers_SupplierId", - table: "Products"); - - migrationBuilder.DropIndex( - name: "IX_Products_SupplierId", - table: "Products"); - - migrationBuilder.DropPrimaryKey( - name: "PK_Categories", - table: "Categories"); - - migrationBuilder.DropColumn( - name: "SupplierId", - table: "Products"); - - migrationBuilder.RenameTable( - name: "Categories", - newName: "Category"); - - migrationBuilder.AddPrimaryKey( - name: "PK_Category", - table: "Category", - column: "CategoryId"); - - migrationBuilder.AddForeignKey( - name: "FK_Products_Category_CategoryId", - table: "Products", - column: "CategoryId", - principalTable: "Category", - principalColumn: "CategoryId", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/InventoryManagementSystem/Migrations/20240906185254_product_relationships_fix.Designer.cs b/InventoryManagementSystem/Migrations/20240906185254_product_relationships_fix.Designer.cs deleted file mode 100644 index 1fa6132..0000000 --- a/InventoryManagementSystem/Migrations/20240906185254_product_relationships_fix.Designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace InventoryManagementSystem.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20240906185254_product_relationships_fix")] - partial class product_relationships_fix - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("InventoryManagementSystem.Models.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CategoryId")); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CategoryId"); - - b.ToTable("Categories"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Product", b => - { - b.Property("ProductId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductId")); - - b.Property("CategoryId") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Price") - .HasColumnType("double"); - - b.Property("Quantity") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.HasKey("ProductId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("SupplierId"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Supplier", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("Address") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Phone") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Suppliers"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Product", b => - { - b.HasOne("InventoryManagementSystem.Models.Category", "Category") - .WithMany("Products") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("InventoryManagementSystem.Models.Supplier", "Supplier") - .WithMany("Products") - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Category", b => - { - b.Navigation("Products"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Supplier", b => - { - b.Navigation("Products"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/InventoryManagementSystem/Migrations/20240906185254_product_relationships_fix.cs b/InventoryManagementSystem/Migrations/20240906185254_product_relationships_fix.cs deleted file mode 100644 index 243708a..0000000 --- a/InventoryManagementSystem/Migrations/20240906185254_product_relationships_fix.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace InventoryManagementSystem.Migrations -{ - /// - public partial class product_relationships_fix : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/InventoryManagementSystem/Migrations/20240906193710_ChangedProduct.Designer.cs b/InventoryManagementSystem/Migrations/20240906193710_ChangedProduct.Designer.cs deleted file mode 100644 index 289fe1b..0000000 --- a/InventoryManagementSystem/Migrations/20240906193710_ChangedProduct.Designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace InventoryManagementSystem.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20240906193710_ChangedProduct")] - partial class ChangedProduct - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("InventoryManagementSystem.Models.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CategoryId")); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CategoryId"); - - b.ToTable("Categories"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Supplier", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("Address") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Phone") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Suppliers"); - }); - - modelBuilder.Entity("Product", b => - { - b.Property("ProductId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductId")); - - b.Property("CategoryId") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Price") - .HasColumnType("double"); - - b.Property("Quantity") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.HasKey("ProductId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("SupplierId"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("Product", b => - { - b.HasOne("InventoryManagementSystem.Models.Category", "Category") - .WithMany("Products") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("InventoryManagementSystem.Models.Supplier", "Supplier") - .WithMany("Products") - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Category", b => - { - b.Navigation("Products"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Supplier", b => - { - b.Navigation("Products"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/InventoryManagementSystem/Migrations/20240906193710_ChangedProduct.cs b/InventoryManagementSystem/Migrations/20240906193710_ChangedProduct.cs deleted file mode 100644 index a3cb1bc..0000000 --- a/InventoryManagementSystem/Migrations/20240906193710_ChangedProduct.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace InventoryManagementSystem.Migrations -{ - /// - public partial class ChangedProduct : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/InventoryManagementSystem/Migrations/20240906202122_CleaningModels.Designer.cs b/InventoryManagementSystem/Migrations/20240906202122_CleaningModels.Designer.cs deleted file mode 100644 index 5912060..0000000 --- a/InventoryManagementSystem/Migrations/20240906202122_CleaningModels.Designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace InventoryManagementSystem.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20240906202122_CleaningModels")] - partial class CleaningModels - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("InventoryManagementSystem.Models.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CategoryId")); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CategoryId"); - - b.ToTable("Categories"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Supplier", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("Address") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Phone") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Suppliers"); - }); - - modelBuilder.Entity("Product", b => - { - b.Property("ProductId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductId")); - - b.Property("CategoryId") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Price") - .HasColumnType("double"); - - b.Property("Quantity") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.HasKey("ProductId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("SupplierId"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("Product", b => - { - b.HasOne("InventoryManagementSystem.Models.Category", "Category") - .WithMany("Products") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("InventoryManagementSystem.Models.Supplier", "Supplier") - .WithMany("Products") - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Category", b => - { - b.Navigation("Products"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Supplier", b => - { - b.Navigation("Products"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/InventoryManagementSystem/Migrations/20240907093153_InitialMigration.Designer.cs b/InventoryManagementSystem/Migrations/20240907093153_InitialMigration.Designer.cs deleted file mode 100644 index 8a2e8a8..0000000 --- a/InventoryManagementSystem/Migrations/20240907093153_InitialMigration.Designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace InventoryManagementSystem.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20240907093153_InitialMigration")] - partial class InitialMigration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("InventoryManagementSystem.Models.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CategoryId")); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CategoryId"); - - b.ToTable("Categories"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Supplier", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("Address") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Phone") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Suppliers"); - }); - - modelBuilder.Entity("Product", b => - { - b.Property("ProductId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductId")); - - b.Property("CategoryId") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Price") - .HasColumnType("double"); - - b.Property("Quantity") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.HasKey("ProductId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("SupplierId"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("Product", b => - { - b.HasOne("InventoryManagementSystem.Models.Category", "Category") - .WithMany("Products") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("InventoryManagementSystem.Models.Supplier", "Supplier") - .WithMany("Products") - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Category", b => - { - b.Navigation("Products"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Supplier", b => - { - b.Navigation("Products"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/InventoryManagementSystem/Migrations/20240907093153_InitialMigration.cs b/InventoryManagementSystem/Migrations/20240907093153_InitialMigration.cs deleted file mode 100644 index 16aa31c..0000000 --- a/InventoryManagementSystem/Migrations/20240907093153_InitialMigration.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace InventoryManagementSystem.Migrations -{ - /// - public partial class InitialMigration : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/InventoryManagementSystem/Migrations/20240909120542_AddProductDescription.Designer.cs b/InventoryManagementSystem/Migrations/20240909120542_AddProductDescription.Designer.cs deleted file mode 100644 index 2a6e675..0000000 --- a/InventoryManagementSystem/Migrations/20240909120542_AddProductDescription.Designer.cs +++ /dev/null @@ -1,143 +0,0 @@ -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace InventoryManagementSystem.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20240909120542_AddProductDescription")] - partial class AddProductDescription - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("InventoryManagementSystem.Models.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CategoryId")); - - b.Property("Name") - .HasColumnType("longtext"); - - b.HasKey("CategoryId"); - - b.ToTable("Categories"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Product", b => - { - b.Property("ProductId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductId")); - - b.Property("CategoryId") - .HasColumnType("int"); - - b.Property("CategoryName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Price") - .HasColumnType("double"); - - b.Property("Quantity") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("SupplierName") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("ProductId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("SupplierId"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Supplier", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("Address") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Phone") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("Suppliers"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Product", b => - { - b.HasOne("InventoryManagementSystem.Models.Category", "Category") - .WithMany("Products") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("InventoryManagementSystem.Models.Supplier", "Supplier") - .WithMany("Products") - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Category", b => - { - b.Navigation("Products"); - }); - - modelBuilder.Entity("InventoryManagementSystem.Models.Supplier", b => - { - b.Navigation("Products"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/InventoryManagementSystem/Migrations/20240909120542_AddProductDescription.cs b/InventoryManagementSystem/Migrations/20240909120542_AddProductDescription.cs deleted file mode 100644 index 85a37c8..0000000 --- a/InventoryManagementSystem/Migrations/20240909120542_AddProductDescription.cs +++ /dev/null @@ -1,79 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace InventoryManagementSystem.Migrations -{ - /// - public partial class AddProductDescription : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CategoryName", - table: "Products", - type: "longtext", - nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AddColumn( - name: "Description", - table: "Products", - type: "longtext", - nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AddColumn( - name: "SupplierName", - table: "Products", - type: "longtext", - nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "Name", - table: "Categories", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CategoryName", - table: "Products"); - - migrationBuilder.DropColumn( - name: "Description", - table: "Products"); - - migrationBuilder.DropColumn( - name: "SupplierName", - table: "Products"); - - migrationBuilder.UpdateData( - table: "Categories", - keyColumn: "Name", - keyValue: null, - column: "Name", - value: ""); - - migrationBuilder.AlterColumn( - name: "Name", - table: "Categories", - type: "longtext", - nullable: false, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - } - } -} diff --git a/InventoryManagementSystem/Migrations/20240906183020_model_change.Designer.cs b/InventoryManagementSystem/Migrations/20240923075928_recreating_clever_cloud_db.Designer.cs similarity index 95% rename from InventoryManagementSystem/Migrations/20240906183020_model_change.Designer.cs rename to InventoryManagementSystem/Migrations/20240923075928_recreating_clever_cloud_db.Designer.cs index 14ad74e..f8bb1f4 100644 --- a/InventoryManagementSystem/Migrations/20240906183020_model_change.Designer.cs +++ b/InventoryManagementSystem/Migrations/20240923075928_recreating_clever_cloud_db.Designer.cs @@ -10,8 +10,8 @@ namespace InventoryManagementSystem.Migrations { [DbContext(typeof(AppDbContext))] - [Migration("20240906183020_model_change")] - partial class model_change + [Migration("20240923075928_recreating_clever_cloud_db")] + partial class recreating_clever_cloud_db { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -32,7 +32,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CategoryId")); b.Property("Name") - .IsRequired() .HasColumnType("longtext"); b.HasKey("CategoryId"); @@ -51,6 +50,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("CategoryId") .HasColumnType("int"); + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + b.Property("Name") .IsRequired() .HasColumnType("longtext"); diff --git a/InventoryManagementSystem/Migrations/20240906202122_CleaningModels.cs b/InventoryManagementSystem/Migrations/20240923075928_recreating_clever_cloud_db.cs similarity index 94% rename from InventoryManagementSystem/Migrations/20240906202122_CleaningModels.cs rename to InventoryManagementSystem/Migrations/20240923075928_recreating_clever_cloud_db.cs index 4d3ed05..06db30a 100644 --- a/InventoryManagementSystem/Migrations/20240906202122_CleaningModels.cs +++ b/InventoryManagementSystem/Migrations/20240923075928_recreating_clever_cloud_db.cs @@ -6,7 +6,7 @@ namespace InventoryManagementSystem.Migrations { /// - public partial class CleaningModels : Migration + public partial class recreating_clever_cloud_db : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -20,7 +20,7 @@ protected override void Up(MigrationBuilder migrationBuilder) { CategoryId = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(type: "longtext", nullable: false) + Name = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => @@ -58,6 +58,8 @@ protected override void Up(MigrationBuilder migrationBuilder) .Annotation("MySql:CharSet", "utf8mb4"), Price = table.Column(type: "double", nullable: false), Quantity = table.Column(type: "int", nullable: false), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), CategoryId = table.Column(type: "int", nullable: false), SupplierId = table.Column(type: "int", nullable: false) }, diff --git a/InventoryManagementSystem/Migrations/AppDbContextModelSnapshot.cs b/InventoryManagementSystem/Migrations/AppDbContextModelSnapshot.cs index 8153385..eaf7ef2 100644 --- a/InventoryManagementSystem/Migrations/AppDbContextModelSnapshot.cs +++ b/InventoryManagementSystem/Migrations/AppDbContextModelSnapshot.cs @@ -47,10 +47,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CategoryId") .HasColumnType("int"); - b.Property("CategoryName") - .IsRequired() - .HasColumnType("longtext"); - b.Property("Description") .IsRequired() .HasColumnType("longtext"); @@ -68,10 +64,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("SupplierId") .HasColumnType("int"); - b.Property("SupplierName") - .IsRequired() - .HasColumnType("longtext"); - b.HasKey("ProductId"); b.HasIndex("CategoryId"); diff --git a/InventoryManagementSystem/global.json b/InventoryManagementSystem/global.json deleted file mode 100644 index 5ce8495..0000000 --- a/InventoryManagementSystem/global.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sdk": { - "version": "8.0.100" - } -}