Create missing MySQL rule settings tables

This commit is contained in:
2026-04-09 21:35:17 +02:00
parent 2f4c6d5bb7
commit 8852b501f5
+40
View File
@@ -949,6 +949,46 @@ LIMIT 1;";
EnsureMySqlColumn(conn, "AspNetUsers", "GoogleEmail", "ALTER TABLE `AspNetUsers` ADD COLUMN `GoogleEmail` longtext NULL;");
EnsureMySqlColumn(conn, "AspNetUsers", "GoogleLinkedAt", "ALTER TABLE `AspNetUsers` ADD COLUMN `GoogleLinkedAt` datetime NULL;");
if (!HasMySqlTable(conn, "RuleSettings"))
{
using var cmd = conn.CreateCommand();
cmd.CommandText = @"CREATE TABLE IF NOT EXISTS `RuleSettings` (
`Id` int 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 (`Id`)
);";
cmd.ExecuteNonQuery();
}
using (var seedRuleSettings = conn.CreateCommand())
{
seedRuleSettings.CommandText = @"INSERT INTO `RuleSettings` (`Id`, `AppliedFollowUpDays`, `AppliedGhostDays`, `OfferFollowUpDays`, `OfferGhostDays`, `FeedbackFollowUpDays`, `FeedbackGhostDays`)
SELECT 1, 14, 30, 7, 14, 7, 14
WHERE NOT EXISTS (SELECT 1 FROM `RuleSettings` WHERE `Id` = 1);";
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, "SystemEmailSettings"))
{
using var cmd = conn.CreateCommand();