feat(CUB-56): Agent State Database Migration

This commit is contained in:
cubecraft-agents[bot]
2026-04-26 10:18:06 +00:00
parent f490098af6
commit 7b7b070dac
15 changed files with 581 additions and 0 deletions

31
backend/Program.cs Normal file
View File

@@ -0,0 +1,31 @@
using ControlCenter.Api.Data;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddOpenApi();
// Register DbContext with PostgreSQL
builder.Services.AddDbContext<AppDbContext>(options =>
{
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection")
?? "Host=localhost;Database=control_center;Username=postgres;Password=postgres";
options.UseNpgsql(connectionString, npgsqlOptions =>
{
npgsqlOptions.MigrationsAssembly(typeof(AppDbContext).Assembly.FullName);
});
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
}
app.UseHttpsRedirection();
app.Run();