ritterim / fluentmigrator-generator

A simple PowerShell script to generate database migrations from the package manager console in Visual Studio.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FluentMigrator.Generator

FluentMigrator is a SQL migration framework designed to help version an application's database. This package allows a developer to quickly create a new migration from within Visual Studio's Package Manager console.

A few notable features:

  • Timestamp generation
  • Migration file named correctly with timestamp
  • Migration added to Migrations folder under current active project

It couldn't be easier!

Getting Started

PM > Install-Package FluentMigrator.Generator

Once installed, open the Package Manager Console in Visual Studio. To get there, go to View > Other Windows > Package Manager Console. Remember to select the active project via the Default Project dropdown.

In the new window, type Add-FluentMigration followed by the name of your migration.

Add-FluentMigration InitialMigration

You should see the following structure in the Default Project project.

ConsoleApplication1
|- /Migrations
    |- 20160219141436_InitialMigration.cs

The migration file contents should look like the following.

using FluentMigrator;

namespace ConsoleApplication1.Migrations
{
    [Migration(20160219141436)]
    public class InitialMigration : Migration
    {
        public override void Up()
        {
        }

        public override void Down()
        {
        }
    }
}

Fill in the migration appropriately.

About

A simple PowerShell script to generate database migrations from the package manager console in Visual Studio.

License:MIT License


Languages

Language:PowerShell 96.1%Language:C# 3.4%Language:Batchfile 0.5%