feat: 添加租户隔离保护触发器的管理方法,并更新迁移文档

This commit is contained in:
2026-07-28 14:45:33 +08:00
parent 99e4e43122
commit 5e993298e7
5 changed files with 61 additions and 4 deletions

View File

@@ -0,0 +1,18 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Tiku.Infrastructure.Persistence.Migrations;
internal static class MigrationBuilderTenantGuardExtensions
{
public static void EnsureTenantIsolationGuards(this MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(PostgreSqlTenantConstraintSql.DropTenantGuards);
migrationBuilder.Sql(PostgreSqlTenantConstraintSql.CreateTenantQuestionReferenceGuard);
migrationBuilder.Sql(PostgreSqlTenantConstraintSql.CreateTaxonomyParentGuard);
}
public static void DropTenantIsolationGuards(this MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(PostgreSqlTenantConstraintSql.DropTenantGuards);
}
}