-
No results found.
Try your search with a different keyword or use * as a wildcard.
DataMigration.cs
using FluentMigrator;
using LinqToDB;
using Nop.Core.Domain.Catalog;
using Nop.Core.Domain.Localization;
using Nop.Core.Domain.Logging;
using Nop.Core.Domain.Media;
using Nop.Core.Domain.Messages;
using Nop.Core.Domain.Security;
using Nop.Data.Mapping;
namespace Nop.Data.Migrations.UpgradeTo470;
[NopUpdateMigration("2023-01-01 00:00:00", "4.70", UpdateMigrationType.Data)]
public class DataMigration : Migration
{
private readonly INopDataProvider _dataProvider;
public DataMigration(INopDataProvider dataProvider)
{
_dataProvider = dataProvider;
}
///
/// Collect the UP migration expressions
///
public override void Up()
{
//#5312 new activity log type
var activityLogTypeTable = _dataProvider.GetTable();
if (!activityLogTypeTable.Any(alt =>
string.Compare(alt.SystemKeyword, "ImportCustomers", StringComparison.InvariantCultureIgnoreCase) ==
0))
_dataProvider.InsertEntity(
new ActivityLogType
{
SystemKeyword = "ImportCustomers",
Enabled = true,
Name = "Customers were imported"
}
);
//6660 new activity log type for update plugin
if (!activityLogTypeTable.Any(alt =>
string.Compare(alt.SystemKeyword, "UpdatePlugin", StringComparison.InvariantCultureIgnoreCase) ==
0))
_dataProvider.InsertEntity(
new ActivityLogType { SystemKeyword = "UpdatePlugin", Enabled = true, Name = "Update a plugin" }
);
//1934
int pageIndex;
var pageSize = 500;
var productAttributeCombinationTableName = nameof(ProductAttributeCombination);
var pac = Schema.Table(productAttributeCombinationTableName);
var columnName = "PictureId";
if (pac.Column(columnName).Exists())
{
#pragma warning disable CS0618
var combinationQuery =
from c in _dataProvider.GetTable()
join p in _dataProvider.GetTable