Skip to content

Instantly share code, notes, and snippets.

@ManfredLange
Created November 10, 2020 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ManfredLange/8cb845851f8eb5081381f7e8ae7d1a09 to your computer and use it in GitHub Desktop.
Save ManfredLange/8cb845851f8eb5081381f7e8ae7d1a09 to your computer and use it in GitHub Desktop.
Abstract base class for migations that do not require a Down() method
using System;
using System.Diagnostics.CodeAnalysis;
using FluentMigrator;
namespace CmdLine.DataAccess.Migrations
{
public abstract class UpOnlyMigration : Migration
{
/// <summary>
/// Do not override/implement this method. [Manfred]
/// </summary>
/// <remarks>We never go back, so no need to implement this method. [Manfred]</remarks>
/// <exception cref="NotImplementedException">Thrown at all times.</exception>
[SuppressMessage("General", "RCS1079:Throwing of new NotImplementedException.", Justification = "Method not needed.")]
public sealed override void Down()
{
throw new NotImplementedException();
}
public abstract override void Up();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment