From f942c30b49355146e93daeade354e59388015df1 Mon Sep 17 00:00:00 2001 From: Drew Rautenberg Date: Wed, 8 Jan 2025 19:04:35 -0600 Subject: [PATCH] added a bunch of shit --- .../20250109005806_InitialCreate.Designer.cs | 57 +++++++++++++++++++ .../20250109005806_InitialCreate.cs | 40 +++++++++++++ .../Migrations/BarkContextModelSnapshot.cs | 54 ++++++++++++++++++ barkmanAPI/barkDbModel.cs | 2 +- barkmanAPI/barkmanAPI.csproj | 4 ++ 5 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 barkmanAPI/Migrations/20250109005806_InitialCreate.Designer.cs create mode 100644 barkmanAPI/Migrations/20250109005806_InitialCreate.cs create mode 100644 barkmanAPI/Migrations/BarkContextModelSnapshot.cs diff --git a/barkmanAPI/Migrations/20250109005806_InitialCreate.Designer.cs b/barkmanAPI/Migrations/20250109005806_InitialCreate.Designer.cs new file mode 100644 index 0000000..b0e6fd2 --- /dev/null +++ b/barkmanAPI/Migrations/20250109005806_InitialCreate.Designer.cs @@ -0,0 +1,57 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace barkman.Migrations +{ + [DbContext(typeof(BarkContext))] + [Migration("20250109005806_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "9.0.0"); + + modelBuilder.Entity("InventoryItems", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Brand") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasColumnType("TEXT"); + + b.Property("RentalPrice") + .HasColumnType("REAL"); + + b.Property("ReplacementCost") + .HasColumnType("REAL"); + + b.Property("SerialNumber") + .HasColumnType("TEXT"); + + b.Property("Status") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Inventory"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/barkmanAPI/Migrations/20250109005806_InitialCreate.cs b/barkmanAPI/Migrations/20250109005806_InitialCreate.cs new file mode 100644 index 0000000..e795521 --- /dev/null +++ b/barkmanAPI/Migrations/20250109005806_InitialCreate.cs @@ -0,0 +1,40 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace barkman.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Inventory", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false), + Brand = table.Column(type: "TEXT", nullable: false), + SerialNumber = table.Column(type: "TEXT", nullable: true), + Status = table.Column(type: "TEXT", nullable: true), + RentalPrice = table.Column(type: "REAL", nullable: true), + ReplacementCost = table.Column(type: "REAL", nullable: true), + Notes = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Inventory", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Inventory"); + } + } +} diff --git a/barkmanAPI/Migrations/BarkContextModelSnapshot.cs b/barkmanAPI/Migrations/BarkContextModelSnapshot.cs new file mode 100644 index 0000000..f2f9ae3 --- /dev/null +++ b/barkmanAPI/Migrations/BarkContextModelSnapshot.cs @@ -0,0 +1,54 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace barkman.Migrations +{ + [DbContext(typeof(BarkContext))] + partial class BarkContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "9.0.0"); + + modelBuilder.Entity("InventoryItems", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Brand") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasColumnType("TEXT"); + + b.Property("RentalPrice") + .HasColumnType("REAL"); + + b.Property("ReplacementCost") + .HasColumnType("REAL"); + + b.Property("SerialNumber") + .HasColumnType("TEXT"); + + b.Property("Status") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Inventory"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/barkmanAPI/barkDbModel.cs b/barkmanAPI/barkDbModel.cs index 7d12683..fc9e1d3 100644 --- a/barkmanAPI/barkDbModel.cs +++ b/barkmanAPI/barkDbModel.cs @@ -12,7 +12,7 @@ public class BarkContext : DbContext { var folder = Environment.SpecialFolder.LocalApplicationData; var path = Environment.GetFolderPath(folder); - DbPath = System.IO.Path.Join(path, "inventory.db"); + DbPath = "./app.db"; } // The following configures EF to create a Sqlite database file in the diff --git a/barkmanAPI/barkmanAPI.csproj b/barkmanAPI/barkmanAPI.csproj index 8af45f7..291eddc 100644 --- a/barkmanAPI/barkmanAPI.csproj +++ b/barkmanAPI/barkmanAPI.csproj @@ -17,4 +17,8 @@ + + + +