fix #2584 - added IsDeleted columns back to Folder and File tables to preserve compatibility for SQLite

This commit is contained in:
Shaun Walker
2023-02-08 08:05:25 -05:00
parent ffca1d2486
commit 475894b680
6 changed files with 57 additions and 10 deletions

View File

@ -0,0 +1,35 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Oqtane.Databases.Interfaces;
using Oqtane.Migrations.EntityBuilders;
using Oqtane.Repository;
namespace Oqtane.Migrations.Tenant
{
[DbContext(typeof(TenantDBContext))]
[Migration("Tenant.03.03.02.01")]
public class AddFolderFileIsDeletedColumns : MultiDatabaseMigration
{
public AddFolderFileIsDeletedColumns(IDatabase database) : base(database)
{
}
protected override void Up(MigrationBuilder migrationBuilder)
{
// IsDeleted columns were removed in 3.2.2 however SQLite does not support column removal so they had to be restored
if (ActiveDatabase.Name != "Sqlite")
{
var folderEntityBuilder = new FolderEntityBuilder(migrationBuilder, ActiveDatabase);
folderEntityBuilder.AddBooleanColumn("IsDeleted");
var fileEntityBuilder = new FileEntityBuilder(migrationBuilder, ActiveDatabase);
fileEntityBuilder.AddBooleanColumn("IsDeleted");
}
}
protected override void Down(MigrationBuilder migrationBuilder)
{
// not implemented
}
}
}