handle HtmlText module transition from SQL scripts to Migrations in module rather than in core framework

This commit is contained in:
Shaun Walker
2021-05-30 13:16:26 -04:00
parent 967f0fe626
commit afcc5e2170
7 changed files with 28 additions and 23 deletions

View File

@ -3,8 +3,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Oqtane.Enums;
using Oqtane.Models;
using Oqtane.Modules.HtmlText.Repository;
using Oqtane.Repository;
using Oqtane.Shared;
namespace Oqtane.Modules
{
@ -38,5 +38,13 @@ namespace Oqtane.Modules
return result;
}
public void AddMigrationHistory(ISqlRepository sqlRepository, Tenant tenant, string MigrationId)
{
var query = "IF NOT EXISTS(SELECT 1 FROM __EFMigrationsHistory WHERE MigrationId = '" + MigrationId + "') ";
query += "INSERT INTO __EFMigrationsHistory(MigrationId, ProductVersion, AppliedDate, AppliedVersion) ";
query += "VALUES('" + MigrationId + "', '5.0.0', SYSDATETIME(), '" + Constants.Version + "')";
sqlRepository.ExecuteNonQuery(tenant, query);
}
}
}