refactor(db): migrate user rule settings
This commit is contained in:
@@ -536,25 +536,6 @@ public static class StartupInitializationExtensions
|
||||
// UiLanguage is migration-owned (AddUiLanguagePreference). Adding it here before
|
||||
// the per-migration loop makes a fresh database fail when that migration runs.
|
||||
|
||||
static void EnsureUserRuleSettingsTable(DbConnection c)
|
||||
{
|
||||
if (HasTable(c, "UserRuleSettings")) return;
|
||||
|
||||
Exec(c, """
|
||||
CREATE TABLE IF NOT EXISTS "UserRuleSettings" (
|
||||
"OwnerUserId" TEXT NOT NULL CONSTRAINT "PK_UserRuleSettings" PRIMARY KEY,
|
||||
"AppliedFollowUpDays" INTEGER NOT NULL,
|
||||
"AppliedGhostDays" INTEGER NOT NULL,
|
||||
"OfferFollowUpDays" INTEGER NOT NULL,
|
||||
"OfferGhostDays" INTEGER NOT NULL,
|
||||
"FeedbackFollowUpDays" INTEGER NOT NULL,
|
||||
"FeedbackGhostDays" INTEGER NOT NULL
|
||||
);
|
||||
""");
|
||||
}
|
||||
|
||||
EnsureUserRuleSettingsTable(conn);
|
||||
|
||||
static void EnsureGmailConnectionsTable(DbConnection c)
|
||||
{
|
||||
Exec(c, """
|
||||
@@ -1453,22 +1434,6 @@ public static class StartupInitializationExtensions
|
||||
seedRuleSettings.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
if (!HasMySqlTable(conn, "UserRuleSettings"))
|
||||
{
|
||||
using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = @"CREATE TABLE IF NOT EXISTS `UserRuleSettings` (
|
||||
`OwnerUserId` varchar(255) NOT NULL,
|
||||
`AppliedFollowUpDays` int NOT NULL,
|
||||
`AppliedGhostDays` int NOT NULL,
|
||||
`OfferFollowUpDays` int NOT NULL,
|
||||
`OfferGhostDays` int NOT NULL,
|
||||
`FeedbackFollowUpDays` int NOT NULL,
|
||||
`FeedbackGhostDays` int NOT NULL,
|
||||
PRIMARY KEY (`OwnerUserId`)
|
||||
);";
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
if (!HasMySqlTable(conn, "CvUploadArtifacts"))
|
||||
{
|
||||
using var cmd = conn.CreateCommand();
|
||||
|
||||
@@ -24,6 +24,7 @@ internal static class StartupSchemaOwnership
|
||||
"SystemEmailSettings",
|
||||
"UserNotifications",
|
||||
"UserOperations",
|
||||
"UserRuleSettings",
|
||||
};
|
||||
|
||||
internal static readonly IReadOnlySet<string> ReconcilerOwnedTables = new HashSet<string>(StringComparer.Ordinal)
|
||||
@@ -60,7 +61,6 @@ internal static class StartupSchemaOwnership
|
||||
"TailoredCvDrafts",
|
||||
"TrustedDevices",
|
||||
"TwoFactorRecoveryCodes",
|
||||
"UserRuleSettings",
|
||||
"UserSessions",
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user