40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Oqtane.Interfaces;
|
|
using Oqtane.Migrations.EntityBuilders;
|
|
using Oqtane.Repository;
|
|
|
|
namespace Oqtane.Migrations
|
|
{
|
|
[DbContext(typeof(TenantDBContext))]
|
|
[Migration("Tenant.01.00.01.01")]
|
|
public class AddAdditionColumnToNotifications : MultiDatabaseMigration
|
|
{
|
|
public AddAdditionColumnToNotifications(IEnumerable<IOqtaneDatabase> databases) : base(databases)
|
|
{
|
|
}
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
//Add Column to Notification table
|
|
var notificationEntityBuilder = new NotificationEntityBuilder(migrationBuilder, ActiveDatabase);
|
|
notificationEntityBuilder.AddDateTimeColumn("SendOn", true);
|
|
|
|
migrationBuilder.Sql(
|
|
@"
|
|
UPDATE Notification
|
|
SET SendOn = CreatedOn
|
|
WHERE SendOn IS NULL;
|
|
");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
//Drop Column from Notification table
|
|
var notificationEntityBuilder = new NotificationEntityBuilder(migrationBuilder, ActiveDatabase);
|
|
notificationEntityBuilder.DropColumn("SendOn");
|
|
}
|
|
}
|
|
}
|