Switch to PostgreSQL and update database configuration

This commit is contained in:
2025-01-21 19:41:18 -06:00
parent 4f76a08ca3
commit 364c7d83e2
7 changed files with 13 additions and 173 deletions
+4 -19
View File
@@ -1,24 +1,10 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
public class BarkContext : DbContext
namespace barkmanapi;
public class BarkContext(DbContextOptions<BarkContext> options) : DbContext(options)
{
public DbSet<InventoryItems> Inventory { get; set; }
public string DbPath { get; }
public BarkContext()
{
var folder = Environment.SpecialFolder.LocalApplicationData;
var path = Environment.GetFolderPath(folder);
DbPath = "./database/app.db";
}
// The following configures EF to create a Sqlite database file in the
// special "local" folder for your platform.
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source={DbPath}");
}
public class InventoryItems
@@ -31,5 +17,4 @@ public class InventoryItems
public float? RentalPrice { get; set; }
public float? ReplacementCost { get; set; }
public string? Notes { get; set; }
}
}