forked from xiongyuxing/tiku-backend.net
feat: add operations content and audit persistence
This commit is contained in:
@@ -0,0 +1,216 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Tiku.Domain.Catalog;
|
||||
using Tiku.Domain.Identity;
|
||||
using Tiku.Domain.Operations;
|
||||
using Tiku.Domain.QuestionBanks;
|
||||
using Tiku.Domain.Tenancy;
|
||||
|
||||
namespace Tiku.Infrastructure.Persistence.Configurations;
|
||||
|
||||
internal sealed class BannerConfiguration : IEntityTypeConfiguration<Banner>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Banner> builder)
|
||||
{
|
||||
builder.ConfigureTenantEntity("banners");
|
||||
builder.ConfigureTimestamps();
|
||||
builder.Property(entity => entity.LegacyId).HasMaxLength(64);
|
||||
builder.Property(entity => entity.Title).HasMaxLength(300);
|
||||
builder.Property(entity => entity.Subtitle).HasMaxLength(500);
|
||||
builder.Property(entity => entity.ButtonText).HasMaxLength(100);
|
||||
builder.Property(entity => entity.ButtonLink).HasMaxLength(2048);
|
||||
builder.Property(entity => entity.BackgroundColor).HasMaxLength(50);
|
||||
builder.Property(entity => entity.BorderColor).HasMaxLength(50);
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.LegacyId }).IsUnique();
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.RegionId, entity.IsActive, entity.SortOrder });
|
||||
builder.HasOne<Region>().WithMany()
|
||||
.HasForeignKey(entity => new { entity.TenantId, entity.RegionId })
|
||||
.HasPrincipalKey(entity => new { entity.TenantId, entity.Id })
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class FaqConfiguration : IEntityTypeConfiguration<Faq>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Faq> builder)
|
||||
{
|
||||
builder.ConfigureTenantEntity("faqs");
|
||||
builder.ConfigureTimestamps();
|
||||
builder.Property(entity => entity.LegacyId).HasMaxLength(64);
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.LegacyId }).IsUnique();
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.RegionId, entity.IsActive, entity.SortOrder });
|
||||
builder.HasOne<Region>().WithMany()
|
||||
.HasForeignKey(entity => new { entity.TenantId, entity.RegionId })
|
||||
.HasPrincipalKey(entity => new { entity.TenantId, entity.Id })
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class AnnouncementConfiguration : IEntityTypeConfiguration<Announcement>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Announcement> builder)
|
||||
{
|
||||
builder.ConfigureTenantEntity("announcements");
|
||||
builder.ConfigureTimestamps();
|
||||
builder.Property(entity => entity.LegacyId).HasMaxLength(64);
|
||||
builder.Property(entity => entity.Link).HasMaxLength(2048);
|
||||
builder.Property(entity => entity.BackgroundColor).HasMaxLength(50);
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.LegacyId }).IsUnique();
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.IsActive, entity.SortOrder });
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class AuditLogConfiguration : IEntityTypeConfiguration<AuditLog>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<AuditLog> builder)
|
||||
{
|
||||
builder.ConfigureEntity("audit_logs");
|
||||
builder.Property(entity => entity.Action).HasMaxLength(200);
|
||||
builder.Property(entity => entity.TargetType).HasMaxLength(200);
|
||||
builder.Property(entity => entity.TargetId).HasMaxLength(200);
|
||||
builder.Property(entity => entity.Details).IsJson("{}");
|
||||
builder.Property(entity => entity.IpAddress).HasMaxLength(100);
|
||||
builder.Property(entity => entity.UserAgent).HasMaxLength(1024);
|
||||
builder.Property(entity => entity.CreatedAt).HasDefaultValueSql("now()");
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.CreatedAt });
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.TargetType, entity.TargetId, entity.CreatedAt });
|
||||
builder.HasOne<Tenant>().WithMany().HasForeignKey(entity => entity.TenantId).OnDelete(DeleteBehavior.Cascade);
|
||||
builder.HasOne<User>().WithMany().HasForeignKey(entity => entity.ActorUserId).OnDelete(DeleteBehavior.SetNull);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class UserNotificationConfiguration : IEntityTypeConfiguration<UserNotification>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<UserNotification> builder)
|
||||
{
|
||||
builder.ConfigureTenantEntity("user_notifications");
|
||||
builder.ConfigureTimestamps();
|
||||
builder.Property(entity => entity.NotificationType).HasMaxLength(100);
|
||||
builder.Property(entity => entity.Status).HasSnakeCaseEnum();
|
||||
builder.Property(entity => entity.Severity).HasSnakeCaseEnum();
|
||||
builder.Property(entity => entity.Title).HasMaxLength(300);
|
||||
builder.Property(entity => entity.ActionLabel).HasMaxLength(100);
|
||||
builder.Property(entity => entity.ActionPath).HasMaxLength(2048);
|
||||
builder.Property(entity => entity.SourceType).HasMaxLength(100);
|
||||
builder.Property(entity => entity.DedupeKey).HasMaxLength(200);
|
||||
builder.Property(entity => entity.Metadata).IsJson("{}");
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.UserId, entity.NotificationType, entity.DedupeKey })
|
||||
.IsUnique()
|
||||
.HasFilter("dedupe_key is not null");
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.UserId, entity.Status, entity.CreatedAt });
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.SourceType, entity.SourceId });
|
||||
builder.HasOne<User>().WithMany().HasForeignKey(entity => entity.UserId).OnDelete(DeleteBehavior.Cascade);
|
||||
builder.HasOne<User>().WithMany().HasForeignKey(entity => entity.CreatedBy).OnDelete(DeleteBehavior.SetNull);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class BadgeConfiguration : IEntityTypeConfiguration<Badge>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Badge> builder)
|
||||
{
|
||||
builder.ConfigureTenantEntity("badges");
|
||||
builder.ConfigureTimestamps();
|
||||
builder.Property(entity => entity.LegacyId).HasMaxLength(64);
|
||||
builder.Property(entity => entity.Name).HasMaxLength(200);
|
||||
builder.Property(entity => entity.Category).HasMaxLength(100);
|
||||
builder.Property(entity => entity.IconUrl).HasMaxLength(2048);
|
||||
builder.Property(entity => entity.UnlockType).HasMaxLength(100);
|
||||
builder.Property(entity => entity.ConditionField).HasMaxLength(100);
|
||||
builder.Property(entity => entity.ConditionOperator).HasMaxLength(50);
|
||||
builder.Property(entity => entity.ConditionValue).HasPrecision(18, 4);
|
||||
builder.Property(entity => entity.ConditionExtra).IsJson("{}");
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.LegacyId }).IsUnique();
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.Category, entity.IsActive, entity.SortOrder });
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class UserBadgeConfiguration : IEntityTypeConfiguration<UserBadge>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<UserBadge> builder)
|
||||
{
|
||||
builder.ConfigureTenantEntity("user_badges");
|
||||
builder.ConfigureTimestamps();
|
||||
builder.Property(entity => entity.LegacyId).HasMaxLength(64);
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.LegacyId }).IsUnique();
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.UserId, entity.BadgeId }).IsUnique();
|
||||
builder.HasOne<User>().WithMany().HasForeignKey(entity => entity.UserId).OnDelete(DeleteBehavior.Cascade);
|
||||
builder.HasOne<Badge>().WithMany()
|
||||
.HasForeignKey(entity => new { entity.TenantId, entity.BadgeId })
|
||||
.HasPrincipalKey(entity => new { entity.TenantId, entity.Id })
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
builder.HasOne<User>().WithMany().HasForeignKey(entity => entity.GrantedBy).OnDelete(DeleteBehavior.SetNull);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class TenantContentNotificationConfiguration : IEntityTypeConfiguration<TenantContentNotification>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<TenantContentNotification> builder)
|
||||
{
|
||||
builder.ConfigureTenantEntity("tenant_content_notifications");
|
||||
builder.ConfigureTimestamps();
|
||||
builder.Property(entity => entity.NotificationType).HasSnakeCaseEnum();
|
||||
builder.Property(entity => entity.Status).HasSnakeCaseEnum();
|
||||
builder.Property(entity => entity.Severity).HasSnakeCaseEnum();
|
||||
builder.Property(entity => entity.Title).HasMaxLength(300);
|
||||
builder.Property(entity => entity.ActionLabel).HasMaxLength(100);
|
||||
builder.Property(entity => entity.ActionPath).HasMaxLength(2048);
|
||||
builder.Property(entity => entity.DedupeKey).HasMaxLength(200);
|
||||
builder.Property(entity => entity.Metadata).IsJson("{}");
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.NotificationType, entity.DedupeKey })
|
||||
.IsUnique()
|
||||
.HasFilter("dedupe_key is not null");
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.Status, entity.CreatedAt });
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.AdoptionId, entity.NotificationType, entity.Status });
|
||||
builder.HasOne<QuestionBank>().WithMany()
|
||||
.HasForeignKey(entity => new { entity.TenantId, entity.SourceQuestionBankId })
|
||||
.HasPrincipalKey(entity => new { entity.TenantId, entity.Id })
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
builder.HasOne<User>().WithMany().HasForeignKey(entity => entity.CreatedBy).OnDelete(DeleteBehavior.SetNull);
|
||||
builder.HasOne<User>().WithMany().HasForeignKey(entity => entity.ReadBy).OnDelete(DeleteBehavior.SetNull);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class TenantThemeTemplateConfiguration : IEntityTypeConfiguration<TenantThemeTemplate>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<TenantThemeTemplate> builder)
|
||||
{
|
||||
builder.ConfigureEntity("tenant_theme_templates");
|
||||
builder.ConfigureTimestamps();
|
||||
builder.Property(entity => entity.Code).HasMaxLength(100);
|
||||
builder.Property(entity => entity.Name).HasMaxLength(200);
|
||||
builder.Property(entity => entity.PreviewImageUrl).HasMaxLength(2048);
|
||||
builder.Property(entity => entity.Theme).IsJson("{}");
|
||||
builder.Property(entity => entity.PublicAssets).IsJson("{}");
|
||||
builder.Property(entity => entity.Status).HasSnakeCaseEnum();
|
||||
builder.HasAlternateKey(entity => entity.Code);
|
||||
builder.HasIndex(entity => entity.Code).IsUnique();
|
||||
builder.HasIndex(entity => new { entity.Status, entity.SortOrder, entity.Code });
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class TenantThemeConfigConfiguration : IEntityTypeConfiguration<TenantThemeConfig>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<TenantThemeConfig> builder)
|
||||
{
|
||||
builder.ConfigureTenantEntity("tenant_theme_configs");
|
||||
builder.ConfigureTimestamps();
|
||||
builder.Property(entity => entity.ActiveTemplateCode).HasMaxLength(100);
|
||||
builder.Property(entity => entity.ActiveTheme).IsJson("{}");
|
||||
builder.Property(entity => entity.ActivePublicAssets).IsJson("{}");
|
||||
builder.Property(entity => entity.DraftTemplateCode).HasMaxLength(100);
|
||||
builder.Property(entity => entity.DraftTheme).IsJson("{}");
|
||||
builder.Property(entity => entity.DraftPublicAssets).IsJson("{}");
|
||||
builder.Property(entity => entity.Status).HasSnakeCaseEnum();
|
||||
builder.HasIndex(entity => entity.TenantId).IsUnique();
|
||||
builder.HasOne<TenantThemeTemplate>().WithMany()
|
||||
.HasForeignKey(entity => entity.ActiveTemplateCode)
|
||||
.HasPrincipalKey(entity => entity.Code)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
builder.HasOne<TenantThemeTemplate>().WithMany()
|
||||
.HasForeignKey(entity => entity.DraftTemplateCode)
|
||||
.HasPrincipalKey(entity => entity.Code)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
builder.HasOne<User>().WithMany().HasForeignKey(entity => entity.PublishedBy).OnDelete(DeleteBehavior.SetNull);
|
||||
builder.HasOne<User>().WithMany().HasForeignKey(entity => entity.DraftUpdatedBy).OnDelete(DeleteBehavior.SetNull);
|
||||
}
|
||||
}
|
||||
12108
Tiku.Infrastructure/Persistence/Migrations/20260725214512_AddOperationsContentAndAuditPersistence.Designer.cs
generated
Normal file
12108
Tiku.Infrastructure/Persistence/Migrations/20260725214512_AddOperationsContentAndAuditPersistence.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,619 @@
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Tiku.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddOperationsContentAndAuditPersistence : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "announcements",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
legacy_id = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
||||
content = table.Column<string>(type: "text", nullable: true),
|
||||
link = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
||||
background_color = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
|
||||
sort_order = table.Column<int>(type: "integer", nullable: false),
|
||||
is_active = table.Column<bool>(type: "boolean", nullable: false),
|
||||
tenant_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
created_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||
updated_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_announcements", x => x.id);
|
||||
table.UniqueConstraint("ak_announcements_tenant_id_id", x => new { x.tenant_id, x.id });
|
||||
table.ForeignKey(
|
||||
name: "fk_announcements_tenants_tenant_id",
|
||||
column: x => x.tenant_id,
|
||||
principalTable: "tenants",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "audit_logs",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
tenant_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
actor_user_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
action = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
|
||||
target_type = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
|
||||
target_id = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
|
||||
details = table.Column<JsonElement>(type: "jsonb", nullable: false, defaultValueSql: "'{}'::jsonb"),
|
||||
ip_address = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
user_agent = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
|
||||
created_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_audit_logs", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_audit_logs_tenants_tenant_id",
|
||||
column: x => x.tenant_id,
|
||||
principalTable: "tenants",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_audit_logs_users_actor_user_id",
|
||||
column: x => x.actor_user_id,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "badges",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
legacy_id = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
||||
name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
|
||||
description = table.Column<string>(type: "text", nullable: true),
|
||||
category = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
icon_url = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
||||
level = table.Column<int>(type: "integer", nullable: true),
|
||||
unlock_type = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
condition_field = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
condition_operator = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
|
||||
condition_value = table.Column<decimal>(type: "numeric(18,4)", precision: 18, scale: 4, nullable: true),
|
||||
condition_extra = table.Column<JsonElement>(type: "jsonb", nullable: false, defaultValueSql: "'{}'::jsonb"),
|
||||
sort_order = table.Column<int>(type: "integer", nullable: false),
|
||||
is_active = table.Column<bool>(type: "boolean", nullable: false),
|
||||
tenant_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
created_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||
updated_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_badges", x => x.id);
|
||||
table.UniqueConstraint("ak_badges_tenant_id_id", x => new { x.tenant_id, x.id });
|
||||
table.ForeignKey(
|
||||
name: "fk_badges_tenants_tenant_id",
|
||||
column: x => x.tenant_id,
|
||||
principalTable: "tenants",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "banners",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
region_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
legacy_id = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
||||
title = table.Column<string>(type: "character varying(300)", maxLength: 300, nullable: true),
|
||||
subtitle = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
|
||||
content = table.Column<string>(type: "text", nullable: true),
|
||||
button_text = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
button_link = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
||||
background_color = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
|
||||
border_color = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
|
||||
sort_order = table.Column<int>(type: "integer", nullable: false),
|
||||
is_active = table.Column<bool>(type: "boolean", nullable: false),
|
||||
tenant_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
created_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||
updated_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_banners", x => x.id);
|
||||
table.UniqueConstraint("ak_banners_tenant_id_id", x => new { x.tenant_id, x.id });
|
||||
table.ForeignKey(
|
||||
name: "fk_banners_regions_tenant_id_region_id",
|
||||
columns: x => new { x.tenant_id, x.region_id },
|
||||
principalTable: "regions",
|
||||
principalColumns: new[] { "tenant_id", "id" },
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "fk_banners_tenants_tenant_id",
|
||||
column: x => x.tenant_id,
|
||||
principalTable: "tenants",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "faqs",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
region_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
legacy_id = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
||||
question = table.Column<string>(type: "text", nullable: true),
|
||||
answer = table.Column<string>(type: "text", nullable: true),
|
||||
sort_order = table.Column<int>(type: "integer", nullable: false),
|
||||
is_active = table.Column<bool>(type: "boolean", nullable: false),
|
||||
tenant_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
created_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||
updated_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_faqs", x => x.id);
|
||||
table.UniqueConstraint("ak_faqs_tenant_id_id", x => new { x.tenant_id, x.id });
|
||||
table.ForeignKey(
|
||||
name: "fk_faqs_regions_tenant_id_region_id",
|
||||
columns: x => new { x.tenant_id, x.region_id },
|
||||
principalTable: "regions",
|
||||
principalColumns: new[] { "tenant_id", "id" },
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "fk_faqs_tenants_tenant_id",
|
||||
column: x => x.tenant_id,
|
||||
principalTable: "tenants",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "tenant_content_notifications",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
adoption_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
source_question_bank_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
created_by = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
read_by = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
notification_type = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
||||
status = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
||||
severity = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
||||
title = table.Column<string>(type: "character varying(300)", maxLength: 300, nullable: false),
|
||||
message = table.Column<string>(type: "text", nullable: false),
|
||||
action_label = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
action_path = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
||||
dedupe_key = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
|
||||
metadata = table.Column<JsonElement>(type: "jsonb", nullable: false, defaultValueSql: "'{}'::jsonb"),
|
||||
read_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||
resolved_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||
tenant_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
created_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||
updated_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_tenant_content_notifications", x => x.id);
|
||||
table.UniqueConstraint("ak_tenant_content_notifications_tenant_id_id", x => new { x.tenant_id, x.id });
|
||||
table.ForeignKey(
|
||||
name: "fk_tenant_content_notifications_question_banks_tenant_id_sourc~",
|
||||
columns: x => new { x.tenant_id, x.source_question_bank_id },
|
||||
principalTable: "question_banks",
|
||||
principalColumns: new[] { "tenant_id", "id" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_tenant_content_notifications_tenants_tenant_id",
|
||||
column: x => x.tenant_id,
|
||||
principalTable: "tenants",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_tenant_content_notifications_users_created_by",
|
||||
column: x => x.created_by,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "fk_tenant_content_notifications_users_read_by",
|
||||
column: x => x.read_by,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "tenant_theme_templates",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
code = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
|
||||
description = table.Column<string>(type: "text", nullable: true),
|
||||
preview_image_url = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
||||
theme = table.Column<JsonElement>(type: "jsonb", nullable: false, defaultValueSql: "'{}'::jsonb"),
|
||||
public_assets = table.Column<JsonElement>(type: "jsonb", nullable: false, defaultValueSql: "'{}'::jsonb"),
|
||||
status = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
||||
sort_order = table.Column<int>(type: "integer", nullable: false),
|
||||
created_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||
updated_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_tenant_theme_templates", x => x.id);
|
||||
table.UniqueConstraint("ak_tenant_theme_templates_code", x => x.code);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "user_notifications",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
user_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
source_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
created_by = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
notification_type = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
status = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
||||
severity = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
||||
title = table.Column<string>(type: "character varying(300)", maxLength: 300, nullable: false),
|
||||
message = table.Column<string>(type: "text", nullable: false),
|
||||
action_label = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
action_path = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
||||
source_type = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
dedupe_key = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
|
||||
metadata = table.Column<JsonElement>(type: "jsonb", nullable: false, defaultValueSql: "'{}'::jsonb"),
|
||||
read_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||
tenant_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
created_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||
updated_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_user_notifications", x => x.id);
|
||||
table.UniqueConstraint("ak_user_notifications_tenant_id_id", x => new { x.tenant_id, x.id });
|
||||
table.ForeignKey(
|
||||
name: "fk_user_notifications_tenants_tenant_id",
|
||||
column: x => x.tenant_id,
|
||||
principalTable: "tenants",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_user_notifications_users_created_by",
|
||||
column: x => x.created_by,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "fk_user_notifications_users_user_id",
|
||||
column: x => x.user_id,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "user_badges",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
user_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
badge_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
granted_by = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
legacy_id = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
||||
note = table.Column<string>(type: "text", nullable: true),
|
||||
granted_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||
tenant_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
created_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||
updated_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_user_badges", x => x.id);
|
||||
table.UniqueConstraint("ak_user_badges_tenant_id_id", x => new { x.tenant_id, x.id });
|
||||
table.ForeignKey(
|
||||
name: "fk_user_badges_badges_tenant_id_badge_id",
|
||||
columns: x => new { x.tenant_id, x.badge_id },
|
||||
principalTable: "badges",
|
||||
principalColumns: new[] { "tenant_id", "id" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_user_badges_tenants_tenant_id",
|
||||
column: x => x.tenant_id,
|
||||
principalTable: "tenants",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_user_badges_users_granted_by",
|
||||
column: x => x.granted_by,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "fk_user_badges_users_user_id",
|
||||
column: x => x.user_id,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "tenant_theme_configs",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
active_template_code = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
active_theme = table.Column<JsonElement>(type: "jsonb", nullable: false, defaultValueSql: "'{}'::jsonb"),
|
||||
active_public_assets = table.Column<JsonElement>(type: "jsonb", nullable: false, defaultValueSql: "'{}'::jsonb"),
|
||||
draft_template_code = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
draft_theme = table.Column<JsonElement>(type: "jsonb", nullable: false, defaultValueSql: "'{}'::jsonb"),
|
||||
draft_public_assets = table.Column<JsonElement>(type: "jsonb", nullable: false, defaultValueSql: "'{}'::jsonb"),
|
||||
status = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
||||
published_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||
published_by = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
draft_updated_by = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
tenant_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
created_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
|
||||
updated_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_tenant_theme_configs", x => x.id);
|
||||
table.UniqueConstraint("ak_tenant_theme_configs_tenant_id_id", x => new { x.tenant_id, x.id });
|
||||
table.ForeignKey(
|
||||
name: "fk_tenant_theme_configs_tenant_theme_templates_active_template~",
|
||||
column: x => x.active_template_code,
|
||||
principalTable: "tenant_theme_templates",
|
||||
principalColumn: "code",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "fk_tenant_theme_configs_tenant_theme_templates_draft_template_~",
|
||||
column: x => x.draft_template_code,
|
||||
principalTable: "tenant_theme_templates",
|
||||
principalColumn: "code",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "fk_tenant_theme_configs_tenants_tenant_id",
|
||||
column: x => x.tenant_id,
|
||||
principalTable: "tenants",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_tenant_theme_configs_users_draft_updated_by",
|
||||
column: x => x.draft_updated_by,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "fk_tenant_theme_configs_users_published_by",
|
||||
column: x => x.published_by,
|
||||
principalTable: "users",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_announcements_tenant_id_is_active_sort_order",
|
||||
table: "announcements",
|
||||
columns: new[] { "tenant_id", "is_active", "sort_order" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_announcements_tenant_id_legacy_id",
|
||||
table: "announcements",
|
||||
columns: new[] { "tenant_id", "legacy_id" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_audit_logs_actor_user_id",
|
||||
table: "audit_logs",
|
||||
column: "actor_user_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_audit_logs_tenant_id_created_at",
|
||||
table: "audit_logs",
|
||||
columns: new[] { "tenant_id", "created_at" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_audit_logs_tenant_id_target_type_target_id_created_at",
|
||||
table: "audit_logs",
|
||||
columns: new[] { "tenant_id", "target_type", "target_id", "created_at" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_badges_tenant_id_category_is_active_sort_order",
|
||||
table: "badges",
|
||||
columns: new[] { "tenant_id", "category", "is_active", "sort_order" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_badges_tenant_id_legacy_id",
|
||||
table: "badges",
|
||||
columns: new[] { "tenant_id", "legacy_id" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_banners_tenant_id_legacy_id",
|
||||
table: "banners",
|
||||
columns: new[] { "tenant_id", "legacy_id" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_banners_tenant_id_region_id_is_active_sort_order",
|
||||
table: "banners",
|
||||
columns: new[] { "tenant_id", "region_id", "is_active", "sort_order" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_faqs_tenant_id_legacy_id",
|
||||
table: "faqs",
|
||||
columns: new[] { "tenant_id", "legacy_id" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_faqs_tenant_id_region_id_is_active_sort_order",
|
||||
table: "faqs",
|
||||
columns: new[] { "tenant_id", "region_id", "is_active", "sort_order" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tenant_content_notifications_created_by",
|
||||
table: "tenant_content_notifications",
|
||||
column: "created_by");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tenant_content_notifications_read_by",
|
||||
table: "tenant_content_notifications",
|
||||
column: "read_by");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tenant_content_notifications_tenant_id_adoption_id_notifica~",
|
||||
table: "tenant_content_notifications",
|
||||
columns: new[] { "tenant_id", "adoption_id", "notification_type", "status" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tenant_content_notifications_tenant_id_notification_type_de~",
|
||||
table: "tenant_content_notifications",
|
||||
columns: new[] { "tenant_id", "notification_type", "dedupe_key" },
|
||||
unique: true,
|
||||
filter: "dedupe_key is not null");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tenant_content_notifications_tenant_id_source_question_bank~",
|
||||
table: "tenant_content_notifications",
|
||||
columns: new[] { "tenant_id", "source_question_bank_id" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tenant_content_notifications_tenant_id_status_created_at",
|
||||
table: "tenant_content_notifications",
|
||||
columns: new[] { "tenant_id", "status", "created_at" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tenant_theme_configs_active_template_code",
|
||||
table: "tenant_theme_configs",
|
||||
column: "active_template_code");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tenant_theme_configs_draft_template_code",
|
||||
table: "tenant_theme_configs",
|
||||
column: "draft_template_code");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tenant_theme_configs_draft_updated_by",
|
||||
table: "tenant_theme_configs",
|
||||
column: "draft_updated_by");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tenant_theme_configs_published_by",
|
||||
table: "tenant_theme_configs",
|
||||
column: "published_by");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tenant_theme_configs_tenant_id",
|
||||
table: "tenant_theme_configs",
|
||||
column: "tenant_id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tenant_theme_templates_code",
|
||||
table: "tenant_theme_templates",
|
||||
column: "code",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_tenant_theme_templates_status_sort_order_code",
|
||||
table: "tenant_theme_templates",
|
||||
columns: new[] { "status", "sort_order", "code" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_badges_granted_by",
|
||||
table: "user_badges",
|
||||
column: "granted_by");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_badges_tenant_id_badge_id",
|
||||
table: "user_badges",
|
||||
columns: new[] { "tenant_id", "badge_id" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_badges_tenant_id_legacy_id",
|
||||
table: "user_badges",
|
||||
columns: new[] { "tenant_id", "legacy_id" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_badges_tenant_id_user_id_badge_id",
|
||||
table: "user_badges",
|
||||
columns: new[] { "tenant_id", "user_id", "badge_id" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_badges_user_id",
|
||||
table: "user_badges",
|
||||
column: "user_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_notifications_created_by",
|
||||
table: "user_notifications",
|
||||
column: "created_by");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_notifications_tenant_id_source_type_source_id",
|
||||
table: "user_notifications",
|
||||
columns: new[] { "tenant_id", "source_type", "source_id" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_notifications_tenant_id_user_id_notification_type_dedu~",
|
||||
table: "user_notifications",
|
||||
columns: new[] { "tenant_id", "user_id", "notification_type", "dedupe_key" },
|
||||
unique: true,
|
||||
filter: "dedupe_key is not null");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_notifications_tenant_id_user_id_status_created_at",
|
||||
table: "user_notifications",
|
||||
columns: new[] { "tenant_id", "user_id", "status", "created_at" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_user_notifications_user_id",
|
||||
table: "user_notifications",
|
||||
column: "user_id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "announcements");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "audit_logs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "banners");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "faqs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "tenant_content_notifications");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "tenant_theme_configs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "user_badges");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "user_notifications");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "tenant_theme_templates");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "badges");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@ using Tiku.Domain.Content;
|
||||
using Tiku.Domain.Growth;
|
||||
using Tiku.Domain.Identity;
|
||||
using Tiku.Domain.Learning;
|
||||
using Tiku.Domain.Operations;
|
||||
using Tiku.Domain.QuestionBanks;
|
||||
using Tiku.Domain.Tenancy;
|
||||
|
||||
@@ -103,6 +104,16 @@ public sealed class TikuDbContext(DbContextOptions<TikuDbContext> options) : DbC
|
||||
public DbSet<TenantCommissionSetting> TenantCommissionSettings => Set<TenantCommissionSetting>();
|
||||
public DbSet<CommissionSettlement> CommissionSettlements => Set<CommissionSettlement>();
|
||||
public DbSet<CommissionSettlementItem> CommissionSettlementItems => Set<CommissionSettlementItem>();
|
||||
public DbSet<Banner> Banners => Set<Banner>();
|
||||
public DbSet<Faq> Faqs => Set<Faq>();
|
||||
public DbSet<Announcement> Announcements => Set<Announcement>();
|
||||
public DbSet<AuditLog> AuditLogs => Set<AuditLog>();
|
||||
public DbSet<UserNotification> UserNotifications => Set<UserNotification>();
|
||||
public DbSet<Badge> Badges => Set<Badge>();
|
||||
public DbSet<UserBadge> UserBadges => Set<UserBadge>();
|
||||
public DbSet<TenantContentNotification> TenantContentNotifications => Set<TenantContentNotification>();
|
||||
public DbSet<TenantThemeTemplate> TenantThemeTemplates => Set<TenantThemeTemplate>();
|
||||
public DbSet<TenantThemeConfig> TenantThemeConfigs => Set<TenantThemeConfig>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user