Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

MySqlDateTimeWithPrecisionMigration.cs

using FluentMigrator;
using Nop.Data;
using Nop.Data.Mapping;
using Nop.Data.Migrations;
using Nop.Plugin.Tax.Avalara.Domain;

namespace Nop.Plugin.Tax.Avalara.Data;

[NopMigration("2022-07-13 00:00:02", "Tax.Avalara 2.65. Update datetime type precision", MigrationProcessType.Update)]
public class MySqlDateTimeWithPrecisionMigration : Migration
{

    /// 
    /// Collect the UP migration expressions
    /// 
    public override void Up()
    {
        var dataSettings = DataSettingsManager.LoadSettings();

        //update the types only in MySql 
        if (dataSettings.DataProvider != DataProviderType.MySql)
            return;

        Alter.Table(NameCompatibilityManager.GetTableName(typeof(TaxTransactionLog)))
            .AlterColumn(NameCompatibilityManager.GetColumnName(typeof(TaxTransactionLog), nameof(TaxTransactionLog.CreatedDateUtc)))
            .AsCustom("datetime(6)");
    }

    /// 
    /// Collects the DOWN migration expressions
    /// 
    public override void Down()
    {
        //nothing
    }
}