Spaces:
Running
Running
User commited on
Commit ·
22f4a07
1
Parent(s): 63ceb92
deploy: update to latest release with Id case fix for notifications in seed_supabase.sql
Browse files
TaskTrackingSystem.Database/AppDbContextModels/AppDbContext.cs
CHANGED
|
@@ -180,7 +180,12 @@ public partial class AppDbContext : DbContext
|
|
| 180 |
entity.Property(e => e.DelayReason).HasMaxLength(300);
|
| 181 |
entity.Property(e => e.BlockedBy).HasMaxLength(200);
|
| 182 |
entity.Property(e => e.DueDate).HasColumnType("timestamp with time zone");
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
entity.Property(e => e.StartDate).HasColumnType("timestamp with time zone");
|
|
|
|
| 184 |
entity.Property(e => e.Title).HasMaxLength(200);
|
| 185 |
entity.Property(e => e.UpdatedAt).HasColumnType("timestamp with time zone");
|
| 186 |
|
|
@@ -302,6 +307,9 @@ public partial class AppDbContext : DbContext
|
|
| 302 |
.HasDefaultValueSql("CURRENT_TIMESTAMP")
|
| 303 |
.HasColumnType("timestamp with time zone");
|
| 304 |
entity.Property(e => e.DueDate).HasColumnType("timestamp with time zone");
|
|
|
|
|
|
|
|
|
|
| 305 |
entity.Property(e => e.Title).HasMaxLength(200);
|
| 306 |
entity.Property(e => e.UpdatedAt).HasColumnType("timestamp with time zone");
|
| 307 |
|
|
|
|
| 180 |
entity.Property(e => e.DelayReason).HasMaxLength(300);
|
| 181 |
entity.Property(e => e.BlockedBy).HasMaxLength(200);
|
| 182 |
entity.Property(e => e.DueDate).HasColumnType("timestamp with time zone");
|
| 183 |
+
entity.Property(e => e.EscalationLevel).HasDefaultValue(0);
|
| 184 |
+
entity.Property(e => e.IsBlocked).HasDefaultValue(false);
|
| 185 |
+
entity.Property(e => e.IsDeleted).HasDefaultValue(false);
|
| 186 |
+
entity.Property(e => e.PriorityId).HasDefaultValue(TaskPriority.Medium);
|
| 187 |
entity.Property(e => e.StartDate).HasColumnType("timestamp with time zone");
|
| 188 |
+
entity.Property(e => e.StatusId).HasDefaultValue(AppTaskStatus.Todo);
|
| 189 |
entity.Property(e => e.Title).HasMaxLength(200);
|
| 190 |
entity.Property(e => e.UpdatedAt).HasColumnType("timestamp with time zone");
|
| 191 |
|
|
|
|
| 307 |
.HasDefaultValueSql("CURRENT_TIMESTAMP")
|
| 308 |
.HasColumnType("timestamp with time zone");
|
| 309 |
entity.Property(e => e.DueDate).HasColumnType("timestamp with time zone");
|
| 310 |
+
entity.Property(e => e.IsArchived).HasDefaultValue(false);
|
| 311 |
+
entity.Property(e => e.PriorityId).HasDefaultValue(TaskPriority.Medium);
|
| 312 |
+
entity.Property(e => e.StatusId).HasDefaultValue(AppTaskStatus.Todo);
|
| 313 |
entity.Property(e => e.Title).HasMaxLength(200);
|
| 314 |
entity.Property(e => e.UpdatedAt).HasColumnType("timestamp with time zone");
|
| 315 |
|
TaskTrackingSystem.Database/Scripts/seed_supabase.sql
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
TaskTrackingSystem.WebApi/Program.cs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
| 1 |
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
| 2 |
using Microsoft.AspNetCore.Authorization;
|
| 3 |
using Microsoft.AspNetCore.Identity;
|
| 4 |
using TaskTrackingSystem.Database.AppDbContextModels;
|
|
@@ -131,6 +133,41 @@ static async System.Threading.Tasks.Task EnsureSeedDataAsync(WebApplication app)
|
|
| 131 |
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
| 132 |
|
| 133 |
await db.Database.EnsureCreatedAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
var dashboardMenu = await db.Menus.FirstOrDefaultAsync(m => m.MenuCode == "DASHBOARD");
|
| 136 |
if (dashboardMenu == null)
|
|
@@ -333,6 +370,18 @@ static async System.Threading.Tasks.Task EnsureSeedDataAsync(WebApplication app)
|
|
| 333 |
await db.SaveChangesAsync();
|
| 334 |
}
|
| 335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
static async System.Threading.Tasks.Task EnsureIssueReportMenuAsync(AppDbContext db)
|
| 337 |
{
|
| 338 |
var reportsMenu = await db.Menus.FirstOrDefaultAsync(m => m.MenuCode == "REPORTS" && !m.IsDeleted);
|
|
|
|
| 1 |
using Microsoft.EntityFrameworkCore;
|
| 2 |
+
using Microsoft.EntityFrameworkCore.Infrastructure;
|
| 3 |
+
using Microsoft.EntityFrameworkCore.Storage;
|
| 4 |
using Microsoft.AspNetCore.Authorization;
|
| 5 |
using Microsoft.AspNetCore.Identity;
|
| 6 |
using TaskTrackingSystem.Database.AppDbContextModels;
|
|
|
|
| 133 |
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
| 134 |
|
| 135 |
await db.Database.EnsureCreatedAsync();
|
| 136 |
+
// In Supabase/Hugging Face, EnsureCreatedAsync() might skip table creation
|
| 137 |
+
// because other schemas (auth, storage, etc.) contain tables.
|
| 138 |
+
// We check if the 'Menus' table exists in the public schema, and force creation of tables if it doesn't.
|
| 139 |
+
var databaseCreator = db.Database.GetService<IDatabaseCreator>() as RelationalDatabaseCreator;
|
| 140 |
+
if (databaseCreator != null)
|
| 141 |
+
{
|
| 142 |
+
var connection = db.Database.GetDbConnection();
|
| 143 |
+
var connectionOpened = false;
|
| 144 |
+
if (connection.State != System.Data.ConnectionState.Open)
|
| 145 |
+
{
|
| 146 |
+
await db.Database.OpenConnectionAsync();
|
| 147 |
+
connectionOpened = true;
|
| 148 |
+
}
|
| 149 |
+
try
|
| 150 |
+
{
|
| 151 |
+
using var command = connection.CreateCommand();
|
| 152 |
+
command.CommandText = "SELECT EXISTS (SELECT FROM pg_tables WHERE schemaname = 'public' AND tablename = 'Menus');";
|
| 153 |
+
var tableExists = (bool)(await command.ExecuteScalarAsync() ?? false);
|
| 154 |
+
if (!tableExists)
|
| 155 |
+
{
|
| 156 |
+
await databaseCreator.CreateTablesAsync();
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
finally
|
| 160 |
+
{
|
| 161 |
+
if (connectionOpened)
|
| 162 |
+
{
|
| 163 |
+
await db.Database.CloseConnectionAsync();
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
await EnsureReportUpgradeSchemaAsync(db);
|
| 169 |
+
|
| 170 |
+
|
| 171 |
|
| 172 |
var dashboardMenu = await db.Menus.FirstOrDefaultAsync(m => m.MenuCode == "DASHBOARD");
|
| 173 |
if (dashboardMenu == null)
|
|
|
|
| 370 |
await db.SaveChangesAsync();
|
| 371 |
}
|
| 372 |
|
| 373 |
+
static async System.Threading.Tasks.Task EnsureReportUpgradeSchemaAsync(AppDbContext db)
|
| 374 |
+
{
|
| 375 |
+
await db.Database.ExecuteSqlRawAsync(@"
|
| 376 |
+
ALTER TABLE ""Issues"" ADD COLUMN IF NOT EXISTS ""DelayReason"" character varying(300);
|
| 377 |
+
|
| 378 |
+
ALTER TABLE ""Issues"" ADD COLUMN IF NOT EXISTS ""IsBlocked"" boolean NOT NULL DEFAULT FALSE;
|
| 379 |
+
|
| 380 |
+
ALTER TABLE ""Issues"" ADD COLUMN IF NOT EXISTS ""BlockedBy"" character varying(200);
|
| 381 |
+
|
| 382 |
+
ALTER TABLE ""Issues"" ADD COLUMN IF NOT EXISTS ""EscalationLevel"" integer NOT NULL DEFAULT 0;
|
| 383 |
+
");
|
| 384 |
+
}
|
| 385 |
static async System.Threading.Tasks.Task EnsureIssueReportMenuAsync(AppDbContext db)
|
| 386 |
{
|
| 387 |
var reportsMenu = await db.Menus.FirstOrDefaultAsync(m => m.MenuCode == "REPORTS" && !m.IsDeleted);
|