mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-06-12 22:11:54 +00:00
broke and fixed db at the same time
This commit is contained in:
@@ -1,74 +0,0 @@
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using barkmanapi;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
[DbContext(typeof(BarkContext))]
|
||||
[Migration("20250122011527_postyFirst")]
|
||||
partial class postyFirst
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("barkmanapi.InventoryItems", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Brand")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("brand");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<float?>("RentalPrice")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("rental_price");
|
||||
|
||||
b.Property<float?>("ReplacementCost")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("replacement_cost");
|
||||
|
||||
b.Property<string>("SerialNumber")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("serial_number");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_inventory");
|
||||
|
||||
b.ToTable("inventory", (string)null);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class postyFirst : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "inventory",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
name = table.Column<string>(type: "text", nullable: false),
|
||||
brand = table.Column<string>(type: "text", nullable: false),
|
||||
serial_number = table.Column<string>(type: "text", nullable: true),
|
||||
status = table.Column<string>(type: "text", nullable: true),
|
||||
rental_price = table.Column<float>(type: "real", nullable: true),
|
||||
replacement_cost = table.Column<float>(type: "real", nullable: true),
|
||||
notes = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_inventory", x => x.id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "inventory");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using barkmanapi;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
[DbContext(typeof(BarkContext))]
|
||||
[Migration("20250123185805_status")]
|
||||
partial class status
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("barkmanapi.InventoryItems", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Brand")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("brand");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<float?>("RentalPrice")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("rental_price");
|
||||
|
||||
b.Property<float?>("ReplacementCost")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("replacement_cost");
|
||||
|
||||
b.Property<string>("SerialNumber")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("serial_number");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_inventory");
|
||||
|
||||
b.ToTable("inventory", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.ItemStatus", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_item_status");
|
||||
|
||||
b.ToTable("item_status", (string)null);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class status : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "item_status",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<string>(type: "text", nullable: false),
|
||||
name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_item_status", x => x.id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "item_status");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using barkmanapi;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
[DbContext(typeof(BarkContext))]
|
||||
[Migration("20250124005211_statuspt2")]
|
||||
partial class statuspt2
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("barkmanapi.InventoryItems", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Brand")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("brand");
|
||||
|
||||
b.Property<string>("ItemStatusId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("item_status_id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<float?>("RentalPrice")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("rental_price");
|
||||
|
||||
b.Property<float?>("ReplacementCost")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("replacement_cost");
|
||||
|
||||
b.Property<string>("SerialNumber")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("serial_number");
|
||||
|
||||
b.Property<string>("StatusId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("status_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_inventory");
|
||||
|
||||
b.HasIndex("ItemStatusId")
|
||||
.HasDatabaseName("ix_inventory_item_status_id");
|
||||
|
||||
b.ToTable("inventory", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.ItemStatus", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_item_status");
|
||||
|
||||
b.ToTable("item_status", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.InventoryItems", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.ItemStatus", null)
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("ItemStatusId")
|
||||
.HasConstraintName("fk_inventory_item_status_item_status_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.ItemStatus", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class statuspt2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "status",
|
||||
table: "inventory",
|
||||
newName: "status_id");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "item_status_id",
|
||||
table: "inventory",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_inventory_item_status_id",
|
||||
table: "inventory",
|
||||
column: "item_status_id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_inventory_item_status_item_status_id",
|
||||
table: "inventory",
|
||||
column: "item_status_id",
|
||||
principalTable: "item_status",
|
||||
principalColumn: "id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_inventory_item_status_item_status_id",
|
||||
table: "inventory");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "ix_inventory_item_status_id",
|
||||
table: "inventory");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "item_status_id",
|
||||
table: "inventory");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "status_id",
|
||||
table: "inventory",
|
||||
newName: "status");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using barkmanapi;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
[DbContext(typeof(BarkContext))]
|
||||
partial class BarkContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("barkmanapi.InventoryItems", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Brand")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("brand");
|
||||
|
||||
b.Property<string>("ItemStatusId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("item_status_id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<float?>("RentalPrice")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("rental_price");
|
||||
|
||||
b.Property<float?>("ReplacementCost")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("replacement_cost");
|
||||
|
||||
b.Property<string>("SerialNumber")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("serial_number");
|
||||
|
||||
b.Property<string>("StatusId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("status_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_inventory");
|
||||
|
||||
b.HasIndex("ItemStatusId")
|
||||
.HasDatabaseName("ix_inventory_item_status_id");
|
||||
|
||||
b.ToTable("inventory", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.ItemStatus", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_item_status");
|
||||
|
||||
b.ToTable("item_status", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.InventoryItems", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.ItemStatus", null)
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("ItemStatusId")
|
||||
.HasConstraintName("fk_inventory_item_status_item_status_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.ItemStatus", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ inventoryGroup.MapGet("", async (BarkContext db) =>
|
||||
inventoryGroup.MapGet("/{id}", async (int id, BarkContext db) =>
|
||||
{
|
||||
var item = await db.Inventory
|
||||
.Include(item => item.StatusId)
|
||||
.Include(item => item.Status)
|
||||
.FirstOrDefaultAsync(i => i.Id == id);
|
||||
|
||||
if (item == null)
|
||||
@@ -75,7 +75,7 @@ inventoryGroup.MapPut("/{id}", async (int id, InventoryItems updatedItem, BarkCo
|
||||
existingItem.Name = updatedItem.Name;
|
||||
existingItem.Brand = updatedItem.Brand;
|
||||
existingItem.SerialNumber = updatedItem.SerialNumber;
|
||||
existingItem.StatusId = updatedItem.StatusId;
|
||||
existingItem.Status = updatedItem.Status;
|
||||
existingItem.RentalPrice = updatedItem.RentalPrice;
|
||||
existingItem.ReplacementCost = updatedItem.ReplacementCost;
|
||||
existingItem.Notes = updatedItem.Notes;
|
||||
|
||||
@@ -14,7 +14,7 @@ public class InventoryItems
|
||||
public string Name { get; set; }
|
||||
public string Brand { get; set; }
|
||||
public string? SerialNumber { get; set; }
|
||||
public ItemStatus StatusId { get; set; }
|
||||
public ItemStatus Status { get; set; }
|
||||
public float? RentalPrice { get; set; }
|
||||
public float? ReplacementCost { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
|
||||
@@ -19,4 +19,8 @@
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user