Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

aneeshmohandas/FluentMigration.Generator

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

FluentMigration.Generator

Dotnet tool helps to create fluent migration file(fluentmigrator) from model class.

Install

dotnet tool install --global FluentMigration.Generator.PostgreSql --version 1.0.0

RUN

add-migration --c "Database Connection String" --a "Assembly Location" 

Example

Model

[Table("Fruit", Schema = "public")] //required
public class Fruit
{
    public Guid Id { get; set; }
    public string Name { get; set; }
}

Output

using FluentMigrator;
using System;
namespace MigrationGenerator.PostgreSql.Migrations
{
    [Migration(2022213193819558)] // created from timestamp
    public class Migration_2022213193819558 : Migration
    {
        public override void Up()
        {
            Create.Table("fruit").InSchema("public")
              .WithColumn("id").AsGuid().NotNullable().PrimaryKey()
              .WithColumn("name").AsString(100).NotNullable();
        }
        public override void Down()
        {
            Delete.Table("fruit").InSchema("public");
        }
    }
}

About

Dotnet tool helps to create fluent migration file from model class.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.