654acacf5f
CI / backend (pull_request) Successful in 56s
CI / frontend (pull_request) Successful in 12s
CI / format (pull_request) Successful in 52s
CI / db-tests (pull_request) Successful in 57s
Security / secrets (pull_request) Successful in 3s
Security / dependencies (pull_request) Successful in 57s
Security / sast (pull_request) Successful in 37s
Root causes + fixes: - Archive leaked Sent mail: filter was just 'not in inbox'. Added ExcludeGmailLabels; Archive now excludes SENT/DRAFT/SPAM/TRASH/CHAT by label. - Read Later / Pinned / Unlabelled returned EVERYTHING (no folder case -> default all). Pinned = IsImportant; Read Later = new local IsReadLater marker (+toggle endpoints); Unlabelled = HasUserLabels=false. - Trash & Spam always empty: IncludeSpamTrash=false + sync never set IsTrashed nor created EmailLabel rows. Now fetches spam/trash, sets IsTrashed from the TRASH label, and links every message to its Gmail labels (also fixes Sent/Spam/category-by-label/Unlabelled). - Old Mail: now strictly older than 6 months (was 1 year). Guardrail: sync upsert is now idempotent (drops prior copy before reinsert) so re-sync can't duplicate a message or leave stale labels. 4 new filter tests; 65 backend + frontend green; migration is a single non-destructive column add. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
76 lines
3.5 KiB
C#
76 lines
3.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace InboxIntel.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class FeatureFlagsAndUserSettings : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "feature_flags",
|
|
columns: table => new
|
|
{
|
|
Key = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
|
Enabled = table.Column<bool>(type: "boolean", nullable: false),
|
|
UserOverridable = table.Column<bool>(type: "boolean", nullable: false),
|
|
Description = table.Column<string>(type: "text", nullable: true),
|
|
CreatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
UpdatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_feature_flags", x => x.Key);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "user_settings",
|
|
columns: table => new
|
|
{
|
|
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Theme = table.Column<string>(type: "text", nullable: false),
|
|
AiOptIn = table.Column<bool>(type: "boolean", nullable: false),
|
|
PreferencesJson = table.Column<string>(type: "text", nullable: true),
|
|
CreatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
UpdatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_user_settings", x => x.UserId);
|
|
table.ForeignKey(
|
|
name: "FK_user_settings_users_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "users",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
// Behaviour-preserving defaults (docs/discovery/multi-provider/04): ai.enabled on
|
|
// (AI availability still requires Ai:Mode + provider), Google on, others off.
|
|
migrationBuilder.Sql("""
|
|
INSERT INTO feature_flags ("Key", "Enabled", "UserOverridable", "Description", "CreatedAtUtc", "UpdatedAtUtc")
|
|
VALUES
|
|
('ai.enabled', TRUE, TRUE, 'Master AI switch: off hides AI for everyone', NOW(), NOW()),
|
|
('provider.google', TRUE, FALSE, 'Google/Gmail provider', NOW(), NOW()),
|
|
('provider.microsoft', FALSE, FALSE, 'Microsoft/Outlook provider (future)', NOW(), NOW()),
|
|
('provider.imap', FALSE, FALSE, 'IMAP provider (future)', NOW(), NOW())
|
|
ON CONFLICT ("Key") DO NOTHING;
|
|
""");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "feature_flags");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "user_settings");
|
|
}
|
|
}
|
|
}
|