-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
NEST-486: Renaming EmailQuotaIndex columns and dropping index
- Loading branch information
Showing
4 changed files
with
15 additions
and
43 deletions.
There are no files selected for viewing
24 changes: 0 additions & 24 deletions
24
Lombiq.Hosting.Tenants.EmailQuotaManagement/Indexes/EmailQuotaIndex.cs
This file was deleted.
Oops, something went wrong.
26 changes: 13 additions & 13 deletions
26
Lombiq.Hosting.Tenants.EmailQuotaManagement/Migrations/EmailQuotaMigrations.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
using Lombiq.Hosting.Tenants.EmailQuotaManagement.Indexes; | ||
using OrchardCore.Data.Migration; | ||
using System; | ||
using YesSql.Sql; | ||
|
||
namespace Lombiq.Hosting.Tenants.EmailQuotaManagement.Migrations; | ||
|
||
public class EmailQuotaMigrations : DataMigration | ||
{ | ||
public int Create() | ||
// This is actually needed like this, otherwise it won't work. | ||
#pragma warning disable S3400 | ||
public int Create() => 3; | ||
#pragma warning restore S3400 | ||
|
||
public int UpdateFrom1() | ||
{ | ||
SchemaBuilder.CreateMapIndexTable<EmailQuotaIndex>( | ||
table => table.Column<int>(nameof(EmailQuotaIndex.CurrentEmailUsageCount)) | ||
.Column<DateTime>(nameof(EmailQuotaIndex.LastReminderUtc)) | ||
.Column<int>(nameof(EmailQuotaIndex.LastReminderPercentage))); | ||
SchemaBuilder.AlterTable("EmailQuotaIndex", table => table | ||
.AddColumn<int>("LastReminderPercentage") | ||
); | ||
|
||
return 2; | ||
} | ||
|
||
public int UpdateFrom1() | ||
public int UpdateFrom2() | ||
{ | ||
SchemaBuilder.AlterTable(nameof(EmailQuotaIndex), table => table | ||
.AddColumn<int>(nameof(EmailQuotaIndex.LastReminderPercentage)) | ||
); | ||
// Deleting index because it is not needed. | ||
SchemaBuilder.DropTable("EmailQuotaIndex"); | ||
|
||
return 2; | ||
return 3; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters