Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ghhv/6a485943a29fd6b9e499946457a951f2 to your computer and use it in GitHub Desktop.
Save ghhv/6a485943a29fd6b9e499946457a951f2 to your computer and use it in GitHub Desktop.
Fix 1 for Oqtane V3.0.3 bug with non MS SQL databases
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Oqtane.Databases.Interfaces;
using Oqtane.Migrations.EntityBuilders;
using Oqtane.Repository;
using Oqtane.Shared;
namespace Oqtane.Migrations.Tenant
{
[DbContext(typeof(TenantDBContext))]
[Migration("Tenant.03.00.02.02")]
public class UpdateSettingIsPrivate : MultiDatabaseMigration
{
public UpdateSettingIsPrivate(IDatabase database) : base(database)
{
}
protected override void Up(MigrationBuilder migrationBuilder)
{
var settingEntityBuilder = new SettingEntityBuilder(migrationBuilder, ActiveDatabase);
settingEntityBuilder.AddBooleanColumn("IsPrivate", true);
settingEntityBuilder.UpdateColumn("IsPrivate", "0", "bool", "");
settingEntityBuilder.UpdateColumn("IsPrivate", "1", "bool", $"{RewriteName("EntityName")} = 'Site' AND { RewriteName("SettingName")} LIKE 'SMTP%'");
settingEntityBuilder.DropColumn("IsPublic");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
// not implemented
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment